home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Commo-Support / Disk-Archive / includes-1_4.dms / includes-1_4.adf / doc.zoo / exec.doc < prev    next >
Encoding:
Text File  |  1989-12-19  |  111.9 KB  |  3,965 lines

  1. TABLE OF CONTENTS
  2.  
  3. exec.library/AbortIO
  4. exec.library/AddDevice
  5. exec.library/AddHead
  6. exec.library/AddIntServer
  7. exec.library/AddLibrary
  8. exec.library/AddMemList
  9. exec.library/AddPort
  10. exec.library/AddResource
  11. exec.library/AddSemaphore
  12. exec.library/AddTail
  13. exec.library/AddTask
  14. exec.library/Alert
  15. exec.library/AllocAbs
  16. exec.library/Allocate
  17. exec.library/AllocEntry
  18. exec.library/AllocMem
  19. exec.library/AllocSignal
  20. exec.library/AllocTrap
  21. exec.library/AllocVec
  22. exec.library/AttemptSemaphore
  23. exec.library/AvailMem
  24. exec.library/CacheClearE
  25. exec.library/CacheClearU
  26. exec.library/CacheControl
  27. exec.library/Cause
  28. exec.library/CheckIO
  29. exec.library/CloseDevice
  30. exec.library/CloseLibrary
  31. exec.library/ColdReboot
  32. exec.library/CopyMem
  33. exec.library/CopyMemQuick
  34. exec.library/CreateIORequest
  35. exec.library/CreateMsgPort
  36. exec.library/Deallocate
  37. exec.library/DeleteIORequest
  38. exec.library/DeleteMsgPort
  39. exec.library/Debug
  40. exec.library/Disable
  41. exec.library/DoIO
  42. exec.library/Enable
  43. exec.library/Enqueue
  44. exec.library/FindName
  45. exec.library/FindPort
  46. exec.library/FindResident
  47. exec.library/FindSemaphore
  48. exec.library/FindTask
  49. exec.library/Forbid
  50. exec.library/FreeEntry
  51. exec.library/FreeMem
  52. exec.library/FreeSignal
  53. exec.library/FreeTrap
  54. exec.library/FreeVec
  55. exec.library/GetCC
  56. exec.library/GetMsg
  57. exec.library/InitCode
  58. exec.library/InitResident
  59. exec.library/InitSemaphore
  60. exec.library/InitStruct
  61. exec.library/Insert
  62. exec.library/MakeFunctions
  63. exec.library/MakeLibrary
  64. exec.library/ObtainSemaphore
  65. exec.library/ObtainSemaphoreShared
  66. exec.library/ObtainSemaphoreList
  67. exec.library/OldOpenLibrary
  68. exec.library/OpenDevice
  69. exec.library/OpenLibrary
  70. exec.library/OpenResource
  71. exec.library/Permit
  72. exec.library/Procure
  73. exec.library/PutMsg
  74. exec.library/RawDoFmt
  75. exec.library/ReleaseSemaphore
  76. exec.library/ReleaseSemaphoreList
  77. exec.library/RemDevice
  78. exec.library/RemHead
  79. exec.library/RemIntServer
  80. exec.library/RemLibrary
  81. exec.library/Remove
  82. exec.library/RemPort
  83. exec.library/RemResource
  84. exec.library/RemSemaphore
  85. exec.library/RemTail
  86. exec.library/RemTask
  87. exec.library/ReplyMsg
  88. exec.library/SendIO
  89. exec.library/SetExcept
  90. exec.library/SetFunction
  91. exec.library/SetIntVector
  92. exec.library/SetSignal
  93. exec.library/SetSR
  94. exec.library/SetTaskPri
  95. exec.library/Signal
  96. exec.library/SumKickData
  97. exec.library/SumLibrary
  98. exec.library/SuperState
  99. exec.library/Supervisor
  100. exec.library/TypeOfMem
  101. exec.library/UserState
  102. exec.library/Vacate
  103. exec.library/Wait
  104. exec.library/WaitIO
  105. exec.library/WaitPort
  106.  
  107. exec.library/AbortIO                    exec.library/AbortIO
  108.  
  109.    NAME
  110.     AbortIO - attempt to abort an in-progress I/O request
  111.  
  112.    SYNOPSIS
  113.     error = AbortIO(iORequest)
  114.     D0        A1
  115.  
  116.     BYTE AbortIO(struct IORequest *);
  117.  
  118.    FUNCTION
  119.     Ask a device to abort a previously started IORequest.  This is done
  120.     by calling the device's ABORTIO vector, with your given IORequest.
  121.  
  122.  
  123.     AbortIO is a command the device that may or may not grant.  If
  124.     successful, the device will stop processing the IORequest, and
  125.     reply to it earlier than it would otherwise have done.
  126.  
  127.    NOTE
  128.     AbortIO() does NOT remove the IORequest from your ReplyPort, OR
  129.     wait for it to complete.  After an AbortIO() you must wait normally
  130.     for the reply message before actually reusing the request.
  131.  
  132.     If a request has already completed when AbortIO() is called, no
  133.     action is taken.
  134.  
  135.    EXAMPLE
  136.         AbortIO(timer_request);
  137.         WaitIO (timer_request);
  138.         /* Message is free to be reused */
  139.  
  140.    INPUTS
  141.     iORequest - pointer to an I/O request block (must have been used
  142.         at least once.  May be active or finished).
  143.  
  144.    RESULTS
  145.     error - Depending on the device and the state of the request, it
  146.         may not be possible to abort a given I/O request.  If for
  147.         some reason the device cannot abort the request, it should
  148.         return an error code in D0.  Not all devices support this
  149.         error return.
  150.  
  151.    SEE ALSO
  152.     WaitIO, DoIO, SendIO, CheckIO
  153.  
  154. exec.library/AddDevice                      exec.library/AddDevice
  155.  
  156.    NAME
  157.     AddDevice -- add a device to the system
  158.  
  159.    SYNOPSIS
  160.     AddDevice(device)
  161.           A1
  162.  
  163.     void AddDevice(struct Device *);
  164.  
  165.    FUNCTION
  166.     This function adds a new device to the system device list, making
  167.     it available to other programs.  The device must be ready to be
  168.     opened at this time.
  169.  
  170.    INPUTS
  171.     device - pointer to a properly initialized device node
  172.  
  173.    SEE ALSO
  174.     RemDevice, OpenDevice, CloseDevice, MakeLibrary
  175.  
  176. exec.library/AddHead                    exec.library/AddHead
  177.  
  178.    NAME
  179.     AddHead -- insert node at the head of a list
  180.  
  181.    SYNOPSIS
  182.     AddHead(list, node)
  183.         A0    A1
  184.  
  185.     void AddHead(struct List *, struct Node *)
  186.  
  187.    FUNCTION
  188.     Add a node to the head of a doubly linked list. Assembly
  189.     programmers may prefer to use the ADDHEAD macro from
  190.     "exec/lists.i".
  191.  
  192.    WARNING
  193.     This function does not arbitrate for access to the list.  The
  194.     calling task must be the owner of the involved list.
  195.  
  196.    INPUTS
  197.     list - a pointer to the target list header
  198.     node - the node to insert at head
  199.  
  200.    SEE ALSO
  201.     AddTail, Enqueue, Insert, Remove, RemHead, RemTail
  202.  
  203. exec.library/AddIntServer               exec.library/AddIntServer
  204.  
  205.    NAME
  206.     AddIntServer -- add an interrupt server to a system server chain
  207.  
  208.    SYNOPSIS
  209.     AddIntServer(intNum, interrupt)
  210.              D0-0:4  A1
  211.  
  212.     void AddIntServer(ULONG, struct Interrupt *);
  213.  
  214.    FUNCTION
  215.     This function adds a new interrupt server to a given server chain.
  216.     The node is located on the chain in a priority dependent position.
  217.     If this is the first server on a particular chain, interrupts will
  218.     be enabled for that chain.
  219.  
  220.     Each link in the chain will be called in priority order until the
  221.     chain ends or one of the servers returns with the 68000's Z condition
  222.     code clear (indicating non-zero).  Servers on the chain should return
  223.     with the Z flag clear if the interrupt was specifically for that
  224.     server, and no one else.  VERTB servers should always return Z set.
  225.     (Take care with High Level Language servers, the language may not
  226.     have a mechanism for reliably setting the Z flag on exit).
  227.  
  228.     Servers are called with the following register conventions:
  229.  
  230.         D0 - scratch
  231.         D1 - scratch
  232.  
  233.         A0 - scratch
  234.         A1 - server is_Data pointer (scratch)
  235.  
  236.         A5 - jump vector register (scratch)
  237.         A6 - scratch
  238.  
  239.         all other registers must be preserved
  240.  
  241.    INPUTS
  242.     intNum - the Portia interrupt bit number (0 through 14). Processor
  243.          level seven interrupts (NMI) are encoded as intNum 15.
  244.          The PORTS, COPER, VERTB, EXTER and NMI interrupts are
  245.          set up as server chains.
  246.     interrupt - pointer to an Interrupt structure.
  247.          By convention, the LN_NAME of the interrupt structure must
  248.          point a descriptive string so that other users may
  249.          identify who currently has control of the interrupt.
  250.  
  251.    WARNING
  252.     Some compilers or assemblers may optimize code in unexpected ways,
  253.     affecting the conditions codes returned from the function.  Watch
  254.     out for a "MOVEM" instruction (which does not affect the condition
  255.     codes) turning into "MOVE" (which does).
  256.  
  257.    BUGS
  258.     The graphics library's VBLANK server currently assumes that
  259.     address register A0 will contain a pointer to the custom chips.  If
  260.     you add a server at a priority of 10 or greater, you must
  261.     compensate for this by providing the expected value ($DFF000).
  262.  
  263.    SEE ALSO
  264.     RemIntServer, SetIntVector, hardware/intbits.i,exec/interrupts.i
  265.  
  266. exec.library/AddLibrary                              exec.library/AddLibrary
  267.  
  268.    NAME
  269.     AddLibrary -- add a library to the system
  270.  
  271.    SYNOPSIS
  272.     AddLibrary(library)
  273.            A1
  274.  
  275.     void AddLibrary(struct Library *);
  276.  
  277.    FUNCTION
  278.     This function adds a new library to the system, making it available
  279.     to other programs.  The library should be ready to be opened at
  280.     this time.  It will be added to the system library name list, and
  281.     the checksum on the library entries will be calculated.
  282.  
  283.    INPUTS
  284.     library - pointer to a properly initialized library structure
  285.  
  286.    SEE ALSO
  287.     RemLibrary, CloseLibrary, OpenLibrary, MakeLibrary
  288.  
  289. exec.library/AddMemList                  exec.library/AddMemList
  290.  
  291.    NAME
  292.     AddMemList - add memory to the system free pool
  293.  
  294.    SYNOPSIS
  295.     AddMemList( size, attributes, pri, base, name )
  296.                      D0      D1        D2   A0    A1
  297.  
  298.     void AddMemList(ULONG, ULONG, LONG, APTR, STRPTR);
  299.  
  300.    FUNCTION
  301.     Add a new region of memory to the system free pool.  The first few
  302.     bytes will be used to hold the MemHeader structure.  The remainder
  303.     will be made available to the rest of the world.
  304.  
  305.    INPUTS
  306.     size - the size (in bytes) of the memory area
  307.     attributes - the attributes word that the memory pool will have
  308.     pri  - the priority for this memory.  CHIP memory has a pri of -10,
  309.            16 bit expansion memory has a priority of 0.  The higher the
  310.            priority, the closer to the head of the memory list it will
  311.            be placed.
  312.     base - the base of the new memory area
  313.     name - the name that will be used in the memory header, or NULL
  314.            if no name is to be provided.  This name is not copied, so it
  315.            must remain valid for as long as the memory header is in the
  316.            system.
  317.  
  318.    SEE ALSO
  319.     AllocMem, exec/memory.h
  320.  
  321. exec.library/AddPort                    exec.library/AddPort
  322.  
  323.    NAME
  324.     AddPort -- add a public message port to the system
  325.  
  326.    SYNOPSIS
  327.     AddPort(port)
  328.         A1
  329.  
  330.     void AddPort(struct MsgPort *);
  331.  
  332.    FUNCTION
  333.     This function attaches a message port structure to the system's
  334.     public message port list, where it can be found by the FindPort()
  335.     function.  The name and priority fields of the port structure must
  336.     be initialized prior to calling this function.    If the user does
  337.     not require the priority field, it should be initialized to zero.
  338.  
  339.     Only ports that will be searched for with FindPort() need to
  340.     be added to the system list.  In addition, adding ports is often
  341.     useful during debugging.  If the port will be searched for,
  342.     the priority field should be at least 1 (to avoid the large number
  343.     of inactive ports at priority zero).  If the port will be searched
  344.     for often, set the proritiry in the 50-100 range (so it will be
  345.     before other less used ports).
  346.  
  347.     Once a port has been added to the naming list, you must be careful
  348.     to remove the port from the list (via RemPort) before deallocating
  349.     its memory.
  350.  
  351.    NOTE
  352.     A point of confusion is that clearing a MsgPort structure to all
  353.     zeros is not enough to prepare it for use.  As mentioned in the
  354.     Exec chapter of the ROM Kernel Manual, the List for the MsgPort
  355.     must be initialized.  This is automatically handled by AddPort(),
  356.     and amiga.lib/CreatePort.  This initialization can be done manually
  357.     with amiga.lib/NewList or the assembly NEWLIST macro.
  358.  
  359.     Do not AddPort an active port.
  360.  
  361.    INPUTS
  362.     port - pointer to a message port
  363.  
  364.    SEE ALSO
  365.     RemPort, FindPort, amiga.lib/CreatePort, amiga.lib/NewList
  366.  
  367. exec.library/AddResource                exec.library/AddResource
  368.  
  369.    NAME
  370.     AddResource -- add a resource to the system
  371.  
  372.    SYNOPSIS
  373.     AddResource(resource)
  374.             A1
  375.  
  376.     void AddResource(APTR);
  377.  
  378.    FUNCTION
  379.     This function adds a new resource to the system and makes it
  380.     available to other users.  The resource must be ready to be called
  381.     at this time.
  382.  
  383.     Resources currently have no system-imposed structure, however they
  384.     must start with a standard named node (LN_SIZE), and should with
  385.     a standard Library node (LIB_SIZE).
  386.  
  387.    INPUTS
  388.     resource - pointer an initialized resource node
  389.  
  390.    SEE ALSO
  391.     RemResource, OpenResource, MakeLibrary
  392.  
  393. exec.library/AddSemaphore               exec.library/AddSemaphore
  394.  
  395.    NAME
  396.     AddSemaphore -- initialize then add a signal semaphore to the system
  397.  
  398.    SYNOPSIS
  399.     AddSemaphore(signalSemaphore)
  400.              A1
  401.  
  402.     void AddSemaphore(struct SignalSemaphore *);
  403.  
  404.    FUNCTION
  405.     This function attaches a signal semaphore structure to the system's
  406.     public signal semaphore list.  The name and priority fields of the
  407.     semaphore structure must be initialized prior to calling this
  408.     function.  If you do not want to let others rendezvous with this
  409.     semaphore, use InitSemaphore() instead.
  410.  
  411.     If a semaphore has been added to the naming list, you must be
  412.     careful to remove the semaphore from the list (via RemSemaphore)
  413.     before deallocating its memory.
  414.  
  415.     Semaphores that are linked together in an allocation list (which
  416.     ObtainSemaphoreList() would use) may not be added to the system
  417.     naming list, because the facilities use the link field of the
  418.     signal semaphore in incompatible ways
  419.  
  420.    INPUTS
  421.        signalSemaphore -- an signal semaphore structure
  422.  
  423.    BUGS
  424.     Does not work in Exec <V36.  Instead use this code:
  425.  
  426.         #include <exec/execbase.h>
  427.         #include <exec/nodes.h>
  428.         extern struct ExecBase *SysBase;
  429.         ...
  430.         void LocalAddSemaphore(s)
  431.         struct SignalSemaphore *s;
  432.         {
  433.         s->ss_Link.ln_Type=NT_SIGNALSEM;
  434.         InitSemaphore(s);
  435.         Forbid();
  436.         Enqueue(&SysBase->SemaphoreList,s);
  437.         Permit();
  438.         }
  439.  
  440.    SEE ALSO
  441.     RemSemaphore, FindSemaphore, InitSemaphore
  442.  
  443. exec.library/AddTail                    exec.library/AddTail
  444.  
  445.    NAME
  446.     AddTail -- append node to tail of a list
  447.  
  448.    SYNOPSIS
  449.     AddTail(list, node)
  450.                 A0    A1
  451.  
  452.     void AddTail(struct List *, struct Node *);
  453.  
  454.    FUNCTION
  455.     Add a node to the tail of a doubly linked list.  Assembly
  456.     programmers may prefer to use the ADDTAIL macro from
  457.     "exec/lists.i".
  458.  
  459.    WARNING
  460.     This function does not arbitrate for access to the list.  The
  461.     calling task must be the owner of the involved list.
  462.  
  463.    INPUTS
  464.     list - a pointer to the target list header
  465.     node - a pointer to the node to insert at tail of the list
  466.  
  467.    SEE ALSO
  468.     AddHead, Enqueue, Insert, Remove, RemHead, RemTail
  469.  
  470. exec.library/AddTask                    exec.library/AddTask
  471.  
  472.    NAME
  473.     AddTask -- add a task to the system
  474.  
  475.    SYNOPSIS
  476.     AddTask(task, initialPC, finalPC)
  477.         A1    A2     A3
  478.  
  479.     void AddTask(struct Task *, APTR, APTR);
  480.  
  481.    FUNCTION
  482.     Add a task to the system.  A reschedule will be run; the task with
  483.     the highest priority in the system will start to execute (this may
  484.     or may not be the new task).
  485.  
  486.     Certain fields of the task control block must be initialized and a
  487.     stack allocated prior to calling this function.  The absolute
  488.     smallest stack that is allowable is something in the range of 100
  489.     bytes, but in general the stack size is dependent on what
  490.     subsystems are called. In general 256 bytes is sufficient if only
  491.     Exec is called, and 4K will do if anything in the system is called.
  492.     DO NOT UNDERESTIMATE.  If you use a stack sniffing utility,
  493.     leave a healthy pad above the minimum value.  The system guarantees
  494.     that it's stack operations will leave the stack longword aligned.
  495.  
  496.     This function will temporarily use space from the new task's stack
  497.     for the task's initial set of registers.  This space is allocated
  498.     starting at the SPREG location specified in the task control block
  499.     (not from SPUPPER).  This means that a task's stack may contain
  500.     static data put there prior to its execution.  This is useful for
  501.     providing initialized global variables or some tasks may want to
  502.     use this space for passing the task its initial arguments.
  503.  
  504.     A task's initial registers are set to zero (except the PC).
  505.  
  506.     The TC_MEMENTRY field of the task structure may be extended by
  507.     the user to hold additional MemLists (as returned by AllocEntry()).
  508.     These will be automatically be deallocated at RemTask() time.
  509.     If the code you have used to start the task has already added
  510.     something to the MEMENTRY list, simply use AddHead to add your
  511.     new MemLists in.  If no initialization has been done, a NewList will
  512.     need to be performed.
  513.  
  514.    NOTE
  515.     AddTask clears out TC_FLAGS.  
  516.  
  517.    INPUTS
  518.     task - pointer to the task control block (TCB)
  519.     initialPC - the initial entry point's address
  520.     finalPC - the finalization code entry point's address.  If zero,
  521.           the system will use a general finalizer. This pointer is
  522.           placed on the stack as if it were the outermost return
  523.           address.
  524.  
  525.    WARNING
  526.     Tasks are a low-level building block, and are unable to call
  527.     dos.library, or any system function that might call dos.library. 
  528.     See the AmigaDOS CreateProc() for information on Processes.
  529.  
  530.    SEE ALSO
  531.     RemTask, FindTask, amiga.lib/CreateTask, dos/CreateProc,
  532.     amiga.lib/NewList
  533.  
  534. exec.library/Alert                      exec.library/Alert
  535.  
  536.    NAME
  537.     Alert -- alert the user of an error
  538.  
  539.    SYNOPSIS
  540.     Alert(alertNum)
  541.           D7
  542.  
  543.     void Alert(ULONG);
  544.  
  545.    FUNCTION
  546.     Alerts the user of a serious system problem.  This function will
  547.     bring the system to a grinding halt, and do whatever is necessary
  548.     to present the user with a message stating what happened.
  549.     Interrupts are disabled, and an attempt to post the alert is made.
  550.     If that fails, the system is reset.  When the system comes up
  551.     again, Exec notices the cause of the failure and tries again to
  552.     post the alert.
  553.  
  554.     If the Alert is a recoverable type, this call MAY return.
  555.  
  556.     This call may be made at any time, including interrupts.
  557.  
  558.    POST-MORTEM DIAGNOSIS
  559.     There are several options for determining the cause of a crash.
  560.     Descriptions of each alert number can be found in the "alerts.h"
  561.     include file.  Low numbers not mentioned in the include file
  562.     represent 68000 exceptions, see a 68000 manual for details.  The
  563.     most common numbers are:
  564.             $00000003 - Address Error
  565.             $00000004 - Illegal Instruction
  566.     
  567.     A remote terminal can be attached to the Amiga's first built-in
  568.     serial port.  Set the communication parameters to 9600 baud, 8 bits,
  569.     no parity.  Before resetting the machine, the Alert function will
  570.     blink the power LED 10 times.  While the power indicator is flashing,
  571.     pressing DELETE on the remote terminal will invoke the ROMWack
  572.     debugger.
  573.  
  574.     For Alerts caused by a 68000 exception, all registers are copied
  575.     to a magic low memory location (currently 16 longwords at $180).
  576.  
  577.    INPUT
  578.     alertNum   - a number indicating the particular alert.
  579.  
  580.    NOTE
  581.     Much more needs to be said about this function and its implications.
  582.  
  583.    SEE ALSO
  584.     exec/alerts.h
  585.  
  586. exec.library/AllocAbs                       exec.library/AllocAbs
  587.  
  588.    NAME
  589.     AllocAbs -- allocate at a given location
  590.  
  591.    SYNOPSIS
  592.     memoryBlock = AllocAbs(byteSize, location)
  593.     D0               D0     A1
  594.  
  595.     void *AllocAbs(ULONG, APTR);
  596.  
  597.    FUNCTION
  598.     This function attempts to allocate memory at a given absolute
  599.     memory location.  Often this is used by boot-surviving entities
  600.     such as recoverable ram-disks.    If the memory is already being
  601.     used, or if there is not enough memory to satisfy the request,
  602.     AllocAbs will return NULL.
  603.  
  604.     This block may not be exactly the same as the requested block
  605.     because of rounding, but if the return value is non-zero, the block
  606.     is guaranteed to contain the requested range.
  607.  
  608.    INPUTS
  609.     byteSize - the size of the desired block in bytes
  610.            This number is rounded up to the next larger
  611.            block size for the actual allocation.
  612.     location - the address where the memory MUST be.
  613.  
  614.  
  615.    RESULT
  616.     memoryBlock - a pointer to the newly allocated memory block, or
  617.               NULL if failed.
  618.  
  619.    NOTE
  620.     If the free list is corrupt, the system will panic with alert
  621.     AN_MemCorrupt, $01000005.
  622.  
  623.    SEE ALSO
  624.     AllocMem, FreeMem
  625.  
  626. exec.library/Allocate                       exec.library/Allocate
  627.  
  628.    NAME
  629.     Allocate - allocate a block of memory
  630.  
  631.    SYNOPSIS
  632.     memoryBlock=Allocate(memHeader, byteSize)
  633.     D0             A0     D0
  634.  
  635.     void *Allocate(struct MemHeader *, ULONG);
  636.  
  637.    FUNCTION
  638.     This function is used to allocate blocks of memory from a given
  639.     private free memory pool (as specified by a MemHeader and its
  640.     memory chunk list).  Allocate will return the first free block that
  641.     is greater than or equal to the requested size.
  642.  
  643.     All blocks, whether free or allocated, will be block aligned;
  644.     hence, all allocation sizes are rounded up to the next block even
  645.     value (e.g. the minimum allocation resolution is currently 8
  646.     bytes.  A request for 8 bytes will use up exactly 8 bytes.  A
  647.     request for 7 bytes will also use up exactly 8 bytes.).
  648.  
  649.     This function can be used to manage an application's internal data
  650.     memory.  Note that no arbitration of the MemHeader and associated
  651.     free chunk list is done.  You must be the owner before calling
  652.     Allocate.
  653.  
  654.    INPUTS
  655.     memHeader - points to the local memory list header.
  656.     byteSize - the size of the desired block in bytes.
  657.  
  658.    RESULT
  659.     memoryBlock - a pointer to the just allocated free block.
  660.            If there are no free regions large enough to satisfy the
  661.            request, return zero.
  662.  
  663.    EXAMPLE
  664.     #include <exec/types.h>
  665.     #include <exec/memory.h>
  666.     void *AllocMem();
  667.     #define BLOCKSIZE 4096L /* Or whatever you want */
  668.  
  669.     void main()
  670.     {
  671.     struct MemHeader *mh;
  672.     struct MemChunk  *mc;
  673.     APTR   block1;
  674.     APTR   block2;
  675.  
  676.         /* Get the MemHeader needed to keep track of our new block */
  677.         mh = (struct MemHeader *)
  678.          AllocMem((long)sizeof(struct MemHeader), MEMF_CLEAR );
  679.         if( !mh )
  680.         exit(10);
  681.  
  682.         /* Get the actual block the above MemHeader will manage */
  683.         mc = (struct MemChunk *)AllocMem( BLOCKSIZE, 0L );
  684.         if( !mc )
  685.         {
  686.         FreeMem( mh, (long)sizeof(struct MemHeader) ); exit(10);
  687.         }
  688.  
  689.         mh->mh_Node.ln_Type = NT_MEMORY;
  690.         mh->mh_Node.ln_Name = "myname";
  691.         mh->mh_First = mc;
  692.         mh->mh_Lower = (APTR) mc;
  693.         mh->mh_Upper = (APTR) ( BLOCKSIZE + (ULONG) mc );
  694.         mh->mh_Free  = BLOCKSIZE;
  695.  
  696.         /* Set up first chunk in the freelist */
  697.         mc->mc_Next  = NULL;
  698.         mc->mc_Bytes = BLOCKSIZE;
  699.  
  700.         block1 = (APTR) Allocate( mh, 20L );
  701.         block2 = (APTR) Allocate( mh, 314L );
  702.         printf("mh=$%lx mc=$%lx\n",mh,mc);
  703.         printf("Block1=$%lx, Block2=$%lx\n",block1,block2);
  704.  
  705.         FreeMem( mh, (long)sizeof(struct MemHeader) );
  706.         FreeMem( mc, BLOCKSIZE );
  707.     }
  708.  
  709.    NOTE
  710.     If the free list is corrupt, the system will panic with alert
  711.     AN_MemCorrupt, $01000005.
  712.  
  713.    SEE ALSO
  714.     Deallocate, exec/memory.h
  715.  
  716. exec.library/AllocEntry                  exec.library/AllocEntry
  717.  
  718.    NAME
  719.     AllocEntry -- allocate many regions of memory
  720.  
  721.    SYNOPSIS
  722.     memList = AllocEntry(memList)
  723.     D0             A0
  724.  
  725.     struct MemList *AllocEntry(struct MemList *);
  726.  
  727.    FUNCTION
  728.     This function takes a memList structure and allocates enough memory
  729.     to hold the required memory as well as a MemList structure to keep
  730.     track of it.
  731.  
  732.     These MemList structures may be linked together in a task control
  733.     block to keep track of the total memory usage of this task. (See
  734.     the description of TC_MEMENTRY under RemTask).
  735.  
  736.    INPUTS
  737.     memList -- A MemList structure filled in with MemEntry structures.
  738.  
  739.    RESULTS
  740.     memList -- A different MemList filled in with the actual memory
  741.         allocated in the me_Addr field, and their sizes in me_Length.
  742.         If enough memory cannot be obtained, then the requirements of
  743.         the allocation that failed is returned and bit 31 is set.
  744.  
  745.    EXAMPLES
  746.     The user wants five regions of 2, 4, 8, 16, and 32 bytes in size
  747.     with requirements of MEMF_CLEAR, MEMF_PUBLIC, MEMF_CHIP!MEMF_CLEAR,
  748.     MEMF_CLEAR, and MEMF_PUBLIC!MEMF_CLEAR respectively.  The
  749.     following code fragment would do that:
  750.  
  751.         MemListDecl:
  752.         DS.B    LN_SIZE         * reserve space for list node
  753.         DC.W    5            * number of entries
  754.         DC.L    MEMF_CLEAR            * entry #0
  755.         DC.L    2
  756.         DC.L    MEMF_PUBLIC            * entry #1
  757.         DC.L    4
  758.         DC.L    MEMF_CHIP!MEMF_CLEAR        * entry #2
  759.         DC.L    8
  760.         DC.L    MEMF_CLEAR               * entry #3
  761.         DC.L    16
  762.         DC.L    MEMF_PUBLIC!MEMF_CLEAR        * entry #4
  763.         DC.L    32
  764.  
  765.         start:
  766.         LEA.L    MemListDecl(PC),A0
  767.         JSR    _LVOAllocEntry(a6)
  768.         BCLR.L    #31,D0
  769.         BEQ.S    success
  770.  
  771.         ------- Type of memory that we failed on is in D0
  772.  
  773.    BUGS
  774.     If any one of the allocations fails, this function fails to back
  775.     out fully.  This is fixed by the "SetPatch" program on V1.3
  776.     Workbench disks.
  777.  
  778.    SEE ALSO
  779.     exec/memory.h
  780.  
  781. exec.library/AllocMem                       exec.library/AllocMem
  782.  
  783.    NAME
  784.     AllocMem -- allocate memory given certain requirements
  785.  
  786.    SYNOPSIS
  787.     memoryBlock = AllocMem(byteSize, attributes)
  788.     D0               D0     D1
  789.  
  790.     void *AllocMem(ULONG, ULONG);
  791.  
  792.    FUNCTION
  793.     This is the memory allocator to be used by system code and
  794.     applications.  It provides a means of specifying that the allocation
  795.     should be made in a memory area accessible to the chips, or
  796.     accessible to shared system code.
  797.  
  798.     Memory is allocated based on requirements and options.    Any
  799.     "requirement" must be met by a memory allocation, any "option" will
  800.     be applied to the block regardless.  AllocMem will try all memory
  801.     spaces until one is found with the proper requirements and room for
  802.     the memory request.
  803.  
  804.    INPUTS
  805.     byteSize - the size of the desired block in bytes.  (The operating
  806.         system will automatically round this number to a multiple of
  807.         the system memory chunk size)
  808.  
  809.     attributes -
  810.         requirements
  811.  
  812.         If no flags are set, the system will return the best
  813.         available memory block.  For expanded systems, the fast
  814.         memory pool is searched first.
  815.  
  816.         MEMF_CHIP:    If the requested memory will be used by
  817.                 the Amiga custom chips, this flag *must*
  818.                 be set.
  819.         
  820.                 Only certain parts of memory are reachable
  821.                 by the special chip sets' DMA circuitry.
  822.                 Chip DMA includes screen memory, images that
  823.                 are blitted, audio data, copper lists, sprites
  824.                 and trackdisk.device buffers.
  825.  
  826.  
  827.         MEMF_FAST:    This is non-chip memory.  If no flag is set
  828.                 MEMF_FAST is taken as the default.
  829.  
  830.                 DO NOT SPECIFY MEMF_FAST unless you know
  831.                 exactly what you are doing!  If MEMF_FAST is
  832.                 set, AllocMem() will fail on machines that
  833.                 only have chip memory!  This flag may not
  834.                 be set when MEMF_CHIP is set.
  835.  
  836.  
  837.         MEMF_PUBLIC:    Memory that must not be mapped, swapped,
  838.                 or otherwise made non-addressable. ALL
  839.                 MEMORY THAT IS REFERENCED VIA INTERRUPTS
  840.                 AND/OR BY OTHER TASKS MUST BE EITHER PUBLIC
  841.                 OR LOCKED INTO MEMORY! This includes both
  842.                 code and data.
  843.  
  844.         options
  845.  
  846.         MEMF_CLEAR:    The memory will be initialized to all
  847.                 zeros.
  848.  
  849.  
  850.    RESULT
  851.     memoryBlock - a pointer to the newly allocated memory block.
  852.         If there are no free memory regions large enough to satisfy
  853.         the request, zero will be returned.  The pointer must be
  854.         checked for zero before the memory block may be used!
  855.  
  856.    WARNING
  857.     The result of any memory allocation MUST be checked, and a viable
  858.     error handling path taken.  ANY allocation may fail if memory has
  859.     been filled.
  860.  
  861.    EXAMPLES
  862.     AllocMem(64,0L)        - Allocate the best available memory
  863.     AllocMem(25,MEMF_CLEAR) - Allocate the best available memory, and
  864.                   clear it before returning.
  865.     AllocMem(128,MEMF_CHIP) - Allocate chip memory
  866.     AllocMem(128,MEMF_CHIP|MEMF_CLEAR) - Allocate cleared chip memory
  867.     AllocMem(821,MEMF_CHIP|MEMF_PUBLIC|MEMF_CLEAR) - Allocate cleared,
  868.         public, chip memory.
  869.  
  870.    NOTE
  871.     If the free list is corrupt, the system will panic with alert
  872.     AN_MemCorrupt, $01000005.
  873.  
  874.     This function may not be called from interrupts.
  875.  
  876.    SEE ALSO
  877.     FreeMem
  878.  
  879. exec.library/AllocSignal                exec.library/AllocSignal
  880.  
  881.    NAME
  882.     AllocSignal -- allocate a signal bit
  883.  
  884.    SYNOPSIS
  885.     signalNum = AllocSignal(signalNum)
  886.     D0            D0
  887.  
  888.     BYTE AllocSignal(LONG);
  889.  
  890.    FUNCTION
  891.     Allocate a signal bit from the current tasks' pool.  Either a
  892.     particular bit, or the next free bit may be allocated.    The signal
  893.     associated with the bit will be properly initialized (cleared).  At
  894.     least 16 user signals are available per task.  Signals should be
  895.     deallocated before the task exits.
  896.  
  897.     If the signal is already in use (or no free signals are available)
  898.     a -1 is returned.
  899.  
  900.     Allocated signals are only valid for use with the task that
  901.     allocated them.
  902.  
  903.  
  904.    WARNING
  905.     Signals may not be allocated or freed from exception handling code.
  906.  
  907.    INPUTS
  908.     signalNum - the desired signal number {of 0..31} or -1 for no
  909.             preference.
  910.  
  911.    RESULTS
  912.     signalNum - the signal bit number allocated {0..31}. If no signals
  913.             are available, this function returns -1.
  914.  
  915.    SEE ALSO
  916.     FreeSignal
  917.  
  918. exec.library/AllocTrap                      exec.library/AllocTrap
  919.  
  920.    NAME
  921.     AllocTrap -- allocate a processor trap vector
  922.  
  923.    SYNOPSIS
  924.     trapNum = AllocTrap(trapNum)
  925.     D0            D0
  926.  
  927.     LONG AllocTrap(LONG);
  928.  
  929.    FUNCTION
  930.     Allocate a trap number from the current task's pool.  These trap
  931.     numbers are those associated with the 68000 TRAP type instructions.
  932.     Either a particular number, or the next free number may be
  933.     allocated.
  934.  
  935.     If the trap is already in use (or no free traps are available) a -1
  936.     is returned.
  937.  
  938.     This function only affects the currently running task.
  939.  
  940.     Traps are sent to the trap handler pointed at by tc_TrapCode.
  941.     Unless changed by user code, this points to a standard trap
  942.     handler.  The stack frame of the exception handler will be:
  943.  
  944.         0(SP) = Exception vector number.  This will be in the
  945.             range of 32 to 47 (corresponding to the
  946.             Trap #1...Trap #15 instructions).
  947.         4(SP) = 68000/68010/68020/68030, etc. exception frame
  948.  
  949.     tc_TrapData is not used.
  950.  
  951.  
  952.    WARNING
  953.     Traps may not be allocated or freed from exception handling code.
  954.     You are not allowed to write to the exception table yourself.  In
  955.     fact, on some machines you will have trouble finding it - the VBR
  956.     register may be used to remap its location.
  957.  
  958.    INPUTS
  959.     trapNum - the desired trap number {of 0..15} or -1
  960.           for no preference.
  961.  
  962.    RESULTS
  963.     trapNum - the trap number allocated {of 0..15}.  If no traps are
  964.           available, this function returns -1.    Instructions of the
  965.           form "Trap #trapNum" will be sent to the task's trap
  966.           handler.
  967.  
  968.    SEE ALSO
  969.     FreeTrap
  970.  
  971. exec.library/AllocVec                       exec.library/AllocVec
  972.  
  973.    NAME
  974.     AllocVec -- allocate memory and keep track of the size  (V36)
  975.  
  976.    SYNOPSIS
  977.     memoryBlock = AllocVec(byteSize, attributes)
  978.     D0               D0     D1
  979.  
  980.     void *AllocVec(ULONG, ULONG);
  981.  
  982.    FUNCTION
  983.     This function works identically to AllocMem(), but tracks the size
  984.     of the allocation.
  985.  
  986.     See the AllocMem() documentation for details.
  987.  
  988.    WARNING
  989.     The result of any memory allocation MUST be checked, and a viable
  990.     error handling path taken.  ANY allocation may fail if memory has
  991.     been filled.
  992.  
  993.    SEE ALSO
  994.     FreeVec, AllocMem
  995.  
  996. exec.library/AttemptSemaphore               exec.library/AttemptSemaphore
  997.  
  998.    NAME
  999.     AttemptSemaphore -- try to obtain without blocking
  1000.  
  1001.    SYNOPSIS
  1002.     success = AttemptSemaphore(signalSemaphore)
  1003.     D0               A0
  1004.  
  1005.     LONG AttemptSemaphore(struct SignalSemaphore *);
  1006.  
  1007.    FUNCTION
  1008.     This call is similar to ObtainSemaphore(), except that it will not
  1009.     block if the semaphore could not be locked.
  1010.  
  1011.    INPUT
  1012.        signalSemaphore -- an initialized signal semaphore structure
  1013.  
  1014.    RESULT
  1015.     success -- TRUE if the semaphore was locked, false if some
  1016.         other task already possessed the semaphore.
  1017.  
  1018.    SEE ALSO
  1019.     ObtainSemaphore() ObtainSemaphoreShared(), ReleaseSemaphore(),
  1020.     exec/semaphores.h
  1021.  
  1022. exec.library/AvailMem                       exec.library/AvailMem
  1023.  
  1024.    NAME
  1025.     AvailMem -- memory available given certain requirements
  1026.  
  1027.    SYNOPSIS
  1028.     size = AvailMem(attributes)
  1029.     D0        D1
  1030.  
  1031.     ULONG AvailMem(ULONG);
  1032.  
  1033.    FUNCTION
  1034.     This function returns the amount of free memory given certain
  1035.     attributes.
  1036.  
  1037.     To find out what the largest block of a particular type is, add
  1038.     MEMF_LARGEST into the requirements argument.  Returning the largest
  1039.     block is a slow operation.
  1040.  
  1041.    WARNING
  1042.     Due to the effect of multitasking, the value returned may not
  1043.     actually be the amount of free memory available at that instant.
  1044.  
  1045.    INPUTS
  1046.     requirements - a requirements mask as specified in AllocMem.  Any
  1047.                of the AllocMem bits are valid, as is MEMF_LARGEST
  1048.                which returns the size of the largest block matching
  1049.                the requirements.
  1050.  
  1051.    RESULT
  1052.     size - total free space remaining (or the largest free block).
  1053.  
  1054.    NOTE
  1055.     For V36 Exec, AvailMem(MEMF_LARGEST) does a consistency check on
  1056.     the memory list.  Alert AN_MemoryInsane will be pulled if any mismatch
  1057.     is noted.
  1058.  
  1059.    EXAMPLE
  1060.     AvailMem(MEMF_CHIP|MEMF_LARGEST);
  1061.     /* return size of largest available chip memory chunk */
  1062.  
  1063.    SEE ALSO
  1064.     exec/memory.h
  1065.  
  1066. exec.library/CacheClearE                               exec.library/CacheClearE
  1067.  
  1068.    NAME
  1069.     CacheClearE - Instruction & data cache flusing from exceptions (V36)
  1070.  
  1071.    SYNOPSIS
  1072.     CacheClearU(control)
  1073.                  d0
  1074.  
  1075.     void CacheClearU(ULONG);
  1076.  
  1077.    FUNCTION
  1078.     Clear the instruction and/or data caches from an exception or
  1079.     interrupt.
  1080.  
  1081.    INPUTS
  1082.     A mask of values.  Use:
  1083.         -1            clear all caches
  1084.         ~CACRF_ClearI        disable clearing instruction cache
  1085.         ~CACRF_ClearD        disable clearing data cache
  1086.  
  1087.    RESULT
  1088.  
  1089.    EXAMPLE
  1090.  
  1091.    NOTES
  1092.  
  1093.    SEE ALSO
  1094.     CacheClearE, CacheClearU, CacheControl
  1095.  
  1096.  
  1097. exec.library/CacheClearU                               exec.library/CacheClearU
  1098.  
  1099.    NAME
  1100.     CacheClearU - Instruction & data cache flushing from user mode (V36)
  1101.  
  1102.    SYNOPSIS
  1103.     CacheClearU(control)
  1104.                  d0
  1105.  
  1106.     void CacheClearU(ULONG);
  1107.  
  1108.    FUNCTION
  1109.     
  1110.  
  1111.    INPUTS
  1112.  
  1113.    RESULT
  1114.  
  1115.    EXAMPLE
  1116.  
  1117.    NOTES
  1118.  
  1119.    SEE ALSO
  1120.     CacheClearE, CacheClearU, CacheControl
  1121.  
  1122.  
  1123. exec.library/CacheControl                             exec.library/CacheControl
  1124.  
  1125.    NAME
  1126.     CacheControl - Instruction & data cache control (from user mode) (V36)
  1127.  
  1128.    SYNOPSIS
  1129.     oldBits = CacheControl(cachBits,cacheMask)
  1130.     D0                     D0       D1
  1131.  
  1132.     ULONG CacheControl(ULONG,ULONG);
  1133.  
  1134.    FUNCTION
  1135.     This function provides global control of any instruction or data
  1136.     caches that may be connected to the system.  All settings are
  1137.     global -- per task control is not provided.  The list of supported
  1138.     settings is provided in the exec/execbase.i include file.  While
  1139.     the bits currently defined map directly to the Motorola processor
  1140.     CACR register, this may not be true forever.  Alternative cache
  1141.     solutions may patch into the Exec cache functions.
  1142.  
  1143.     Typically programmers can ignore the existance of caches.   Caches
  1144.     will be a concern if you preform any "dirty" operations like DMA,
  1145.     self-modifying code, or building a jump table.
  1146.  
  1147.     This function must only be called from the task level in user mode!
  1148.  
  1149.    INPUTS
  1150.     cacheBits - new values for the bits specified in cacheMask.
  1151.  
  1152.     cacheMask - a mask with ones for all bits to be changed.
  1153.  
  1154.    RESULT
  1155.     oldBIts   - the complete prior values for all settings.
  1156.  
  1157.    EXAMPLE
  1158.  
  1159.    NOTES
  1160.  
  1161.    SEE ALSO
  1162.     CacheClearE, CacheClearU, exec/execbase.i
  1163.  
  1164. exec.library/Cause                      exec.library/Cause
  1165.  
  1166.    NAME
  1167.        Cause -- cause a software interrupt
  1168.  
  1169.    SYNOPSIS
  1170.        Cause(interrupt)
  1171.          A1
  1172.  
  1173.        void Cause(struct Interrupt *);
  1174.  
  1175.    FUNCTION
  1176.     This function causes a software interrupt to occur.  If it is
  1177.     called from user mode (and processor level 0), the software
  1178.     interrupt will preempt the current task.  This call is often used
  1179.     by high-level hardware interrupts to defer medium-length processing
  1180.     down to a lower interrupt level.  Note that a software interrupt is
  1181.     still a real interrupt, and must obey the same restrictions on what
  1182.     system function it may call.
  1183.  
  1184.     Currently only 5 software interrupt priorities are implemented:
  1185.     -32, -16, 0, +16, and +32.  Priorities in between are truncated,
  1186.     values outside the -32/+32 range are not allowed.
  1187.  
  1188.    NOTE
  1189.     When setting up the Interrupt structure, set the node type to
  1190.     NT_INTERRUPT.
  1191.  
  1192.    IMPLEMENTATION
  1193.     1> Checks if the node type is NT_SOFTINT.  If so does nothing since
  1194.        the softint is already pending.  No nest count is maintained.
  1195.     2> Sets the node type to NT_SOFTINT.
  1196.     3> Links into one of the 5 priority queues.
  1197.     4> Pokes the hardware interrupt bit used for softints.
  1198.  
  1199.     The node type returns to NT_INTERRUPT after removal from the list.
  1200.  
  1201.    INPUTS
  1202.     interrupt - pointer to a properly initialized interrupt node
  1203.  
  1204. exec.library/CheckIO                    exec.library/CheckIO
  1205.  
  1206.    NAME
  1207.     CheckIO -- get the status of an IORequest
  1208.  
  1209.    SYNOPSIS
  1210.     result = CheckIO(iORequest)
  1211.     D0         A1
  1212.  
  1213.     BOOL CheckIO(struct IORequest *);
  1214.  
  1215.    FUNCTION
  1216.     This function determines the current state of an I/O request and
  1217.     returns FALSE if the I/O has not yet completed.  This function
  1218.     effectively hides the internals of the I/O completion mechanism.
  1219.  
  1220.     CheckIO will NOT remove the returned IORequest from the reply port.
  1221.     This is best performed with WaitIO(). If the request has already
  1222.     completed, WaitIO() will return quickly. Use of the Remove()
  1223.     function is dangerous, since other tasks may still be adding things
  1224.     to your message port; a Disable() would be required.
  1225.  
  1226.     This function should NOT be used to busy loop (looping until IO is
  1227.     complete).  WaitIO() is provided for that purpose.
  1228.  
  1229.    INPUTS
  1230.     iORequest - pointer to an I/O request block
  1231.  
  1232.    RESULTS
  1233.     result - NULL if I/O is still in progress.  Otherwise
  1234.          D0 points to the IORequest block.
  1235.  
  1236.    SEE ALSO
  1237.     DoIO, SendIO, WaitIO, AbortIO
  1238.  
  1239. exec.library/CloseDevice                exec.library/CloseDevice
  1240.  
  1241.    NAME
  1242.     CloseDevice -- conclude access to a device
  1243.  
  1244.    SYNOPSIS
  1245.     CloseDevice(iORequest)
  1246.             A1
  1247.  
  1248.     void CloseDevice(struct IORequest *);
  1249.  
  1250.    FUNCTION
  1251.     This function informs the device that access to a device/unit
  1252.     previously opened has been concluded.  The device may perform
  1253.     certain house-cleaning operations.
  1254.  
  1255.     The user must ensure that all outstanding IORequests have been
  1256.     returned before closing the device.  The AbortIO function can kill
  1257.     any stragglers.
  1258.  
  1259.     After a close, the I/O request structure is free to be reused.
  1260.     Starting with V36 exec it is safe to CloseDevice() with an
  1261.     IORequest that is either cleared to zeros, or failed to
  1262.     open.
  1263.  
  1264.    INPUTS
  1265.     iORequest - pointer to an I/O request structure
  1266.  
  1267.    SEE ALSO
  1268.     OpenDevice
  1269.  
  1270. exec.library/CloseLibrary               exec.library/CloseLibrary
  1271.  
  1272.    NAME
  1273.     CloseLibrary -- conclude access to a library
  1274.  
  1275.    SYNOPSIS
  1276.     CloseLibrary(library)
  1277.              A1
  1278.  
  1279.     void CloseLibrary(struct Library *);
  1280.  
  1281.    FUNCTION
  1282.     This function informs the system that access to the given library
  1283.     has been concluded.  The user must not reference the library or any
  1284.     function in the library after this close.
  1285.  
  1286.     Starting with V36, it is safe to pass a NULL instead of
  1287.     a library pointer.
  1288.  
  1289.    INPUTS
  1290.     library - pointer to a library node
  1291.  
  1292.    SEE ALSO
  1293.     OpenLibrary
  1294.  
  1295. exec.library/ColdReboot                              exec.library/ColdReboot
  1296.  
  1297.     NAME
  1298.     ColdReboot - reboot the Amiga (V36)
  1299.  
  1300.     SYNOPSIS
  1301.     ColdReboot()
  1302.  
  1303.     void ColdReboot(void);
  1304.  
  1305.     FUNCTION
  1306.     Reboot the machine.  All external memory and periperals will be
  1307.     RESET, and the machine will start its power up diagnostics.
  1308.  
  1309.     This function never returns.
  1310.  
  1311.     INPUT
  1312.     A chaotic pile of disoriented bits.
  1313.  
  1314.     RESULTS
  1315.     An altogether totally integrated living system.
  1316.  
  1317. exec.library/CopyMem                    exec.library/CopyMem
  1318.  
  1319.    NAME
  1320.     CopyMem - general purpose memory copy function
  1321.  
  1322.    SYNOPSIS
  1323.     CopyMem( source, dest, size )
  1324.          A0     A1    D0
  1325.  
  1326.     void CopyMem(APTR,APTR,ULONG);
  1327.  
  1328.    FUNCTION
  1329.     CopyMem is a general purpose, fast memory copy function.  It can
  1330.     deal with arbitrary lengths, with its pointers on arbitrary
  1331.     alignments.  It attempts to optimize larger copies with more
  1332.     efficient copies, it uses byte copies for small moves, parts of
  1333.     larger copies, or the entire copy if the source and destination are
  1334.     misaligned with respect to each other.
  1335.  
  1336.     Arbitrary overlapping copies are not supported.
  1337.  
  1338.     The internal implementation of this function will change from
  1339.     system to system, and may be implemented via hardware DMA.
  1340.  
  1341.    INPUTS
  1342.     source - a pointer to the source data region
  1343.     dest  - a pointer to the destination data region
  1344.     size  - the size (in bytes) of the memory area.  Zero copies
  1345.         zero bytes
  1346.  
  1347.    SEE ALSO
  1348.     CopyMemQuick
  1349.  
  1350. exec.library/CopyMemQuick               exec.library/CopyMemQuick
  1351.  
  1352.    NAME
  1353.     CopyMemQuick - optimized memory copy function
  1354.  
  1355.    SYNOPSIS
  1356.     CopyMemQuick( source, dest, size )
  1357.               A0      A1    D0
  1358.  
  1359.     void CopyMem(ULONG *,ULONG *,ULONG);
  1360.  
  1361.    FUNCTION
  1362.     CopyMemQuick is a highly optimized memory copy function, with
  1363.     restrictions on the size and alignment of its arguments. Both the
  1364.     source and destination pointers must be longword aligned.  In
  1365.     addition, the size must be an integral number of longwords (e.g.
  1366.     the size must be evenly divisible by four).
  1367.  
  1368.     Arbitrary overlapping copies are not supported.
  1369.  
  1370.     The internal implementation of this function will change from system
  1371.     to system, and may be implemented via hardware DMA.
  1372.  
  1373.    INPUTS
  1374.     source - a pointer to the source data region, long aligned
  1375.     dest -  a pointer to the destination data region, long aligned
  1376.     size -  the size (in bytes) of the memory area.  Zero copies
  1377.         zero bytes.
  1378.  
  1379.    SEE ALSO
  1380.     CopyMem
  1381.  
  1382. exec.library/CreateIORequest                       exec.library/CreateIORequest
  1383.  
  1384.    NAME
  1385.     CreateIORequest() -- create an IORequest structure  (V36)
  1386.  
  1387.    SYNOPSIS
  1388.     ioReq = CreateIORequest( ioReplyPort, size );
  1389.                              A0           D0
  1390.  
  1391.     struct IORequest *CreateIORequest(struct MsgPort *, ULONG);
  1392.  
  1393.    FUNCTION
  1394.     Allocates memory for and initializes a new IO request block
  1395.     of a user-specified number of bytes.  The number of bytes
  1396.     MUST be the size of a legal IORequest (or extended IORequest)
  1397.     or very nasty things will happen.
  1398.  
  1399.    INPUTS
  1400.     ioReplyPort - NULL if you wish a message port to be created
  1401.         automatically.    Else the address of
  1402.  
  1403.  
  1404.         a pointer to an already initialized message port
  1405.         to be used for this IO request's reply port. (usually created
  1406.         by CreatePort()).  If NULL, this function fails.
  1407.     size - the size of the IO request to be created.
  1408.  
  1409.    RESULT
  1410.     Returns a pointer to the new IO Request block, or NULL if
  1411.         the request failed.
  1412.  
  1413.    EXAMPLE
  1414.     if( myReq=CreateIORequest( CreatePort(0L,0L),sizeof(struct IOExtTD) ) )
  1415.  
  1416.    SEE ALSO
  1417.     DeleteExtIO, CreatePort()
  1418.  
  1419. exec.library/CreateMsgPort                           exec.library/CreateMsgPort
  1420.  
  1421.    NAME
  1422.     CreateMsgPort - Allocate and initialize a new message port  (V36)
  1423.  
  1424.    SYNOPSIS
  1425.     CreateMsgPort()
  1426.  
  1427.     struct MsgPort * CreateMsgPort(void);
  1428.  
  1429.    FUNCTION
  1430.     Allocates and initializes a new message port.  The message list
  1431.     of the new port will be prepared for use (via NewList).  A signal
  1432.     bit will be allocatred, and the port will be set to signal your
  1433.     task when a message arrives (PA_SIGNAL).
  1434.  
  1435.     You *must* use DeletePort() to delete ports created with
  1436.     CreatePort()!
  1437.  
  1438.    RESULT
  1439.     A new MsgPort structure ready for use.
  1440.  
  1441.     If you wish to add this port to the public port list, fill in
  1442.     the ln_Name and ln_Pri files, then call AddPort().  Don't forget
  1443.     the RemPort()!
  1444.  
  1445.     NULL! Signals!
  1446.  
  1447.    SEE ALSO
  1448.     DeleteMsgPort(), exec/AddPort(), exec/ports.h
  1449.  
  1450. exec.library/Deallocate                  exec.library/Deallocate
  1451.  
  1452.    NAME
  1453.     Deallocate -- deallocate a block of memory
  1454.  
  1455.    SYNOPSIS
  1456.     Deallocate(memHeader, memoryBlock, byteSize)
  1457.            A0          A1       D0
  1458.  
  1459.     void Deallocate(struct MemHeader *,APTR,ULONG);
  1460.  
  1461.    FUNCTION
  1462.     This function deallocates memory by returning it to the appropriate
  1463.     private free memory pool.  This function can be used to free an
  1464.     entire block allocated with the above function, or it can be used
  1465.     to free a sub-block of a previously allocated block.  Sub-blocks
  1466.     must be an even multiple of the memory chunk size (currently 8
  1467.     bytes).
  1468.  
  1469.     This function can even be used to add a new free region to an
  1470.     existing MemHeader, however the extent pointers in the MemHeader
  1471.     will no longer be valid.
  1472.  
  1473.     If memoryBlock is not on a block boundary (MEM_BLOCKSIZE) then it
  1474.     will be rounded down in a manner compatible with Allocate().  Note
  1475.     that this will work correctly with all the memory allocation
  1476.     functions, but may cause surprises if one is freeing only part of a
  1477.     region.  The size of the block will be rounded up, so the freed
  1478.     block will fill to an even memory block boundary.
  1479.  
  1480.    INPUTS
  1481.     memHeader - points to the memory header this block is part of.
  1482.     memoryBlock - address of memory block to free.
  1483.     byteSize - the size of the block in bytes. If NULL, nothing
  1484.            happens.
  1485.  
  1486.    SEE ALSO
  1487.     Allocate, exec/memory.h
  1488.  
  1489. exec.library/Debug                      exec.library/Debug
  1490.  
  1491.    NAME
  1492.     Debug -- run the system debugger
  1493.  
  1494.    SYNOPSIS
  1495.     Debug(flags)
  1496.           D0
  1497.  
  1498.     void Debug(ULONG);
  1499.  
  1500.    FUNCTION
  1501.     This function calls the system debugger.  By default this debugger
  1502.     is "ROM-WACK".  Other debuggers are encouraged to take over this
  1503.     entry point (via SetFunction()) so that when an application calls
  1504.     Debug(), the alternative debugger will get control.  Currently a
  1505.     zero is passed to allow future expansion.
  1506.  
  1507.    NOTE
  1508.     The Debug() call may be made when the system is in a questionable
  1509.     state; if you have a SetFunction() patch, make few assumptions, be
  1510.     prepared for Supervisor mode, and be aware of differences in the
  1511.     Motorola stack frames on the 68000,'10,'20, and '30.
  1512.  
  1513.    SEE ALSO
  1514.     SetFunction
  1515.     your favorite debugger's manual
  1516.     the ROM-WACK chapter of the ROM Kernel Manual
  1517.  
  1518. exec.library/DeleteIORequest                       exec.library/DeleteIORequest
  1519.  
  1520.    NAME
  1521.     DeleteIORequest() - Free a request made by CreateIORequest()  (V36)
  1522.  
  1523.    SYNOPSIS
  1524.     DeleteIORequest( ioReq );
  1525.                      a0
  1526.  
  1527.     void DeleteIORequest(struct IORequest *);
  1528.  
  1529.    FUNCTION
  1530.     Frees up an IO request as allocated by CreateIORequest().
  1531.  
  1532.    INPUTS
  1533.     ioReq - A pointer to the IORequest block to be freed, or NULL.
  1534.         This function used the ln_Length field to determine how
  1535.         much memory to free.
  1536.  
  1537.    SEE ALSO
  1538.     CreateIORequest()
  1539.  
  1540.  
  1541. exec.library/DeleteMsgPort                           exec.library/DeleteMsgPort
  1542.  
  1543.    NAME
  1544.     DeleteMsgPort - Free a message port created by CreateMsgPort  (V36)
  1545.  
  1546.    SYNOPSIS
  1547.     DeleteMsgPort(msgPort)
  1548.               a0
  1549.  
  1550.     void DeleteMsgPort(struct MsgPort *);
  1551.  
  1552.    FUNCTION
  1553.     Frees a message port created by CreateMsgPort.    All messages that
  1554.     may have been attached to this port must have already been
  1555.     replied to.
  1556.  
  1557.    INPUTS
  1558.     msgPort - A message port.  NULL for no action.
  1559.  
  1560.    SEE ALSO
  1561.     CreateMsgPort()
  1562.  
  1563.  
  1564. exec.library/Disable                    exec.library/Disable
  1565.  
  1566.     NAME
  1567.     Disable -- disable interrupt processing.
  1568.  
  1569.     SYNOPSIS
  1570.     Disable();
  1571.  
  1572.     void Disable(void);
  1573.  
  1574.     FUNCTION
  1575.     Prevents interrupts from being handled by the system, until a
  1576.     matching Enable() is executed.  Disable() implies Forbid().
  1577.  
  1578.     DO NOT USE THIS CALL WITHOUT GOOD JUSTIFICATION.  THIS CALL IS
  1579.     VERY DANGEROUS!
  1580.  
  1581.     RESULTS
  1582.     All interrupt processing is deferred until the task executing makes
  1583.     a call to Enable() or is placed in a wait state.  Normal task
  1584.     rescheduling does not occur while interrupts are disabled.  In order
  1585.     to restore normal interrupt processing, the programmer must execute
  1586.     exactly one call to Enable() for every call to Disable().
  1587.  
  1588.     IMPORTANT REMINDER:
  1589.  
  1590.     It is important to remember that there is a danger in using
  1591.     disabled sections.  Disabling interrupts for more than ~250
  1592.     microseconds will prevent vital system functions (especially serial
  1593.     I/0) from operating in a normal fashion.
  1594.  
  1595.     Think twice before using Disable(), then think once more.
  1596.     After all that, think again.  With enough thought, the need
  1597.     for a Disable() can often be eliminated.  For the user of many
  1598.     device drivers, a write to disable *only* the particular interrupt
  1599.     of interest can replace a Disable().  For example:
  1600.             MOVE.W    #INTF_PORTS,_intena
  1601.     Do not use a macro for Disable(), insist on the real thing.
  1602.  
  1603.     This call may be made from interrupts, it will have the effect
  1604.     of locking out all higher-level interrupts (lower-level interrupts
  1605.     are automatically disabled by the CPU).
  1606.  
  1607.         Note: In the event of a task entering a Wait after disabling
  1608.               interrupts, the system "breaks" the disabled state and runs
  1609.               normally until the task which called Disable() is rescheduled.
  1610.  
  1611.    SEE ALSO
  1612.     Forbid, Permit, Enable
  1613.  
  1614. exec.library/DoIO                       exec.library/DoIO
  1615.  
  1616.    NAME
  1617.     DoIO -- perform an I/O command and wait for completion
  1618.  
  1619.    SYNOPSIS
  1620.     error = DoIO(iORequest)
  1621.     D0         A1
  1622.  
  1623.     BYTE DoIO(struct IORequest *);
  1624.  
  1625.    FUNCTION
  1626.     This function requests a device driver to perform the I/O command
  1627.     specified in the I/O request.  This function will always wait until
  1628.     the I/O request is fully complete.
  1629.  
  1630.     DoIO() handles all the details, including Quick I/O, waiting for
  1631.     the request, clearing signal bits, and removing the reply message.
  1632.  
  1633.    IMPLEMENTATION
  1634.     This function first tries to complete the IO via the "Quick I/O"
  1635.     mechanism.  The io_Flags field is always set to IOF_QUICK (0x01)
  1636.     before the internal device call.
  1637.  
  1638.     The LN_TYPE field is used internally to flag completion.  Active
  1639.     requests have type NT_MESSAGE.  Requests that have been replied
  1640.     have type NT_REPLYMSG.  It is illegal to start IO using a
  1641.     still active IORequest, or a request with type NT_REPLYMSG.
  1642.  
  1643.    INPUTS
  1644.     iORequest - pointer to an IORequest initialized by OpenDevice()
  1645.  
  1646.    RESULTS
  1647.     error - a sign-extended copy of the io_Error field of the
  1648.         IORequest.  Most device commands require that the error
  1649.         return be checked.
  1650.  
  1651.    SEE ALSO
  1652.     SendIO, CheckIO, WaitIO, AbortIO, amiga.lib/BeginIO
  1653.  
  1654. exec.library/Enable                     exec.library/Enable
  1655.  
  1656.    NAME
  1657.     Enable -- permit system interrupts to resume.
  1658.  
  1659.    SYNOPSIS
  1660.     Enable();
  1661.  
  1662.     void Enable(void);
  1663.  
  1664.    FUNCTION
  1665.     Allow system interrupts to again occur normally, after a matching
  1666.     Disable() has been executed.
  1667.  
  1668.    RESULTS
  1669.     Interrupt processing is restored to normal operation. The
  1670.     programmer must execute exactly one call to Enable() for every call
  1671.     to Disable().
  1672.  
  1673.    SEE ALSO
  1674.     Forbid, Permit, Disable
  1675.  
  1676.  
  1677. exec.library/Enqueue                    exec.library/Enqueue
  1678.  
  1679.    NAME
  1680.     Enqueue -- insert or append node to a system queue
  1681.  
  1682.    SYNOPSIS
  1683.     Enqueue(list, node)
  1684.         A0    A1
  1685.  
  1686.     void Enqueue(struct List *, struct Node *);
  1687.  
  1688.    FUNCTION
  1689.     Insert or append a node into a system queue.  The insert is
  1690.     performed based on the node priority -- it will keep the list
  1691.     properly sorted.  New nodes will be inserted in front of the first
  1692.     node with a lower priority.   Hence a FIFO queue for nodes of equal
  1693.     priority
  1694.  
  1695.    WARNING
  1696.     This function does not arbitrate for access to the list.  The
  1697.     calling task must be the owner of the involved list.
  1698.  
  1699.    INPUTS
  1700.     list - a pointer to the system queue header
  1701.     node - the node to enqueue.  This must be a full featured list
  1702.            with type, priority and name fields.
  1703.  
  1704.    SEE ALSO
  1705.     AddHead, AddTail, Insert, Remove, RemHead, RemTail
  1706.  
  1707. exec.library/FindName                       exec.library/FindName
  1708.  
  1709.    NAME
  1710.     FindName -- find a system list node with a given name
  1711.  
  1712.    SYNOPSIS
  1713.     node = FindName(start, name)
  1714.     D0,Z        A0     A1
  1715.  
  1716.     struct Node *FindName(struct List *, STRPTR);
  1717.  
  1718.    FUNCTION
  1719.     Traverse a system list until a node with the given name is found.
  1720.     To find multiple occurrences of a string, this function may be
  1721.     called with a node starting point.
  1722.  
  1723.     No arbitration is done for access to the list!    If multiple tasks
  1724.     access the same list, an arbitration mechanism such as
  1725.     SignalSemaphores must be used.
  1726.  
  1727.    INPUTS
  1728.     start - a list header or a list node to start the search
  1729.         (if node, this one is skipped)
  1730.     name - a pointer to a name string terminated with NULL
  1731.  
  1732.    RESULTS
  1733.     node - a pointer to the node with the same name else
  1734.         zero to indicate that the string was not found.
  1735.  
  1736. exec.library/FindPort                      exec.library/FindPort
  1737.  
  1738.    NAME
  1739.     FindPort -- find a given system message port
  1740.  
  1741.    SYNOPSIS
  1742.     port = FindPort(name)
  1743.     D0        A1
  1744.  
  1745.     struct MsgPort *FindPort(STRPTR);
  1746.  
  1747.    FUNCTION
  1748.     This function will search the system message port list for a port
  1749.     with the given name.  The first port matching this name will be
  1750.     returned.  No arbitration of the port list is done.  This function
  1751.     MUST be protected with A Forbid()/Permit() pair!
  1752.  
  1753.    EXAMPLE
  1754.     #include <exec/types.h>
  1755.     struct MsgPort *FindPort();
  1756.  
  1757.     ULONG SafePutToPort(message, portname)
  1758.     struct Message *message;
  1759.     STRPTR          portname;
  1760.     {
  1761.     struct MsgPort *port;
  1762.  
  1763.         Forbid();
  1764.         port = FindPort(portname);
  1765.         if (port)
  1766.             PutMsg(port,message);
  1767.         Permit();
  1768.         return((ULONG)port); /* If zero, the port has gone away */
  1769.     }
  1770.  
  1771.    INPUT
  1772.     name - name of the port to find
  1773.  
  1774.    RETURN
  1775.     port - a pointer to the message port, or zero if
  1776.         not found.
  1777.  
  1778.  
  1779. exec.library/FindResident               exec.library/FindResident
  1780.  
  1781.    NAME
  1782.     FindResident - find a resident module by name
  1783.  
  1784.    SYNOPSIS
  1785.     resident = FindResident(name)
  1786.     D0            A1
  1787.  
  1788.     struct Resident *FindResident(STRPTR);
  1789.  
  1790.    FUNCTION
  1791.     Find the resident tag with the given name.  If found return a
  1792.     pointer to the resident tag structure, else return zero.
  1793.  
  1794.     Resident modules are used by the system to pull all its parts
  1795.     together at startup.  Resident tags are also found in disk based
  1796.     devices and libraries.
  1797.  
  1798.    INPUTS
  1799.     name - pointer to name string
  1800.  
  1801.     RESULT
  1802.     resident - pointer to the resident tag structure or
  1803.         zero if none found.
  1804.  
  1805.     SEE ALSO
  1806.     exec/resident.h
  1807.  
  1808. exec.library/FindSemaphore              exec.library/FindSemaphore
  1809.  
  1810.    NAME
  1811.     FindSemaphore -- find a given system signal semaphore
  1812.  
  1813.    SYNOPSIS
  1814.     signalSemaphore = FindSemaphore(name)
  1815.     D0                        A1
  1816.  
  1817.     struct SignalSemaphore *FindSemaphore(STRPTR);
  1818.  
  1819.    FUNCTION
  1820.     This function will search the system signal semaphore list for a
  1821.     semaphore with the given name.    The first semaphore matching this
  1822.     name will be returned.
  1823.  
  1824.     This function does not arbitrate for access to the semaphore list,
  1825.     surround the call with a Forbid()/Permit() pair.
  1826.  
  1827.    INPUT
  1828.     name - name of the semaphore to find
  1829.  
  1830.    RESULT
  1831.     semaphore - a pointer to the signal semaphore, or zero if not
  1832.             found.
  1833.  
  1834. exec.library/FindTask                       exec.library/FindTask
  1835.  
  1836.    NAME
  1837.     FindTask -- find a task with the given name or find oneself
  1838.  
  1839.    SYNOPSIS
  1840.     task = FindTask(name)
  1841.     D0        A1
  1842.  
  1843.     struct Task *FindTask(STRPTR);
  1844.  
  1845.    FUNCTION
  1846.     This function will check all task queues for a task with the given
  1847.     name, and return a pointer to its task control block.  If a NULL
  1848.     name pointer is given a pointer to the current task will be
  1849.     returned.
  1850.  
  1851.     Finding oneself with a NULL for the name is very quick.  Finding a
  1852.     task by name is very system expensive, and will disable interrupts
  1853.     for a long time.  Since a task may remove itself at any time,
  1854.     a Forbid()/Permit() pair may be needed to ensure the pointer
  1855.     returned by FindTask() is still valid when used.
  1856.  
  1857.    INPUT
  1858.     name - pointer to a name string
  1859.  
  1860.    RESULT
  1861.     task - pointer to the task (or Process)
  1862.  
  1863. exec.library/Forbid                     exec.library/Forbid
  1864.  
  1865.     NAME
  1866.     Forbid -- forbid task rescheduling.
  1867.  
  1868.     SYNOPSIS
  1869.     Forbid()
  1870.  
  1871.     void Forbid(void);
  1872.  
  1873.     FUNCTION
  1874.     Prevents other tasks from being scheduled to run by the dispatcher,
  1875.     until a matching Permit() is executed, or this task is scheduled to
  1876.     Wait.  Interrupts are NOT disabled.
  1877.  
  1878.     DO NOT USE THIS CALL WITHOUT GOOD JUSTIFICATION.  THIS CALL IS
  1879.     DANGEROUS!
  1880.  
  1881.     RESULTS
  1882.     The current task will not be rescheduled as long as it is ready to
  1883.     run.  In the event that the current task enters a wait state, other
  1884.     tasks may be scheduled.  Upon return from the wait state, the original
  1885.     task will continue to run without disturbing the Forbid().
  1886.  
  1887.     Calls to Forbid() nest. In order to restore normal task rescheduling,
  1888.     the programmer must execute exactly one call to Permit() for every
  1889.     call to Forbid().
  1890.  
  1891.     WARNING
  1892.     In the event of a task entering a Wait after a Forbid(), the system
  1893.     "breaks" the forbidden state and runs normally until the task which
  1894.     called Forbid() is rescheduled.  If caution is not taken, this can
  1895.     cause subtle bugs, since any device or DOS call will (in effect)
  1896.     cause your task to wait.
  1897.  
  1898.     Forbid() is not useful or safe from within interrupt code
  1899.     (All interrupts are always higher priority than tasks, and
  1900.     interrupts are allowed to break a Forbid()).
  1901.  
  1902.     NOTE
  1903.     This call is guaranteed to preserve all registers.
  1904.  
  1905.     SEE ALSO
  1906.     Permit, Disable, ObtainSemaphore, ObtainSemaphoreShared
  1907.  
  1908. exec.library/FreeEntry                      exec.library/FreeEntry
  1909.  
  1910.    NAME
  1911.     FreeEntry -- free many regions of memory
  1912.  
  1913.    SYNOPSIS
  1914.     FreeEntry(memList)
  1915.           A0
  1916.     void FreeEntry(struct MemList *);
  1917.  
  1918.    FUNCTION
  1919.     This function takes a memList structure (as returned by AllocEntry)
  1920.     and frees all the entries.
  1921.  
  1922.    INPUTS
  1923.     memList -- pointer to structure filled in with MemEntry
  1924.            structures
  1925.  
  1926.    SEE ALSO
  1927.     AllocEntry
  1928.  
  1929. exec.library/FreeMem                    exec.library/FreeMem
  1930.  
  1931.    NAME
  1932.     FreeMem -- deallocate with knowledge
  1933.  
  1934.    SYNOPSIS
  1935.     FreeMem(memoryBlock, byteSize)
  1936.         A1         D0
  1937.  
  1938.     void FreeMem(void *,ULONG);
  1939.  
  1940.    FUNCTION
  1941.     Free a region of memory, returning it to the system pool from which
  1942.     it came.  Freeing partial blocks back into the system pool is
  1943.     unwise.
  1944.  
  1945.    NOTE
  1946.     If a block of memory is freed twice, the system will Guru. The
  1947.     Alert is AN_FreeTwice ($01000009).   If you pass the wrong pointer,
  1948.     you will probably see AN_MemCorrupt $01000005.  Future versions may
  1949.     add more sanity checks to the memory lists.
  1950.  
  1951.    INPUTS
  1952.     memoryBlock - pointer to the memory block to free
  1953.     byteSize - the size of the desired block in bytes.  (The operating
  1954.         system will automatically round this number to a multiple of
  1955.         the system memory chunk size)
  1956.  
  1957.    SEE ALSO
  1958.     AllocMem
  1959.  
  1960. exec.library/FreeSignal                  exec.library/FreeSignal
  1961.  
  1962.    NAME
  1963.     FreeSignal -- free a signal bit
  1964.  
  1965.    SYNOPSIS
  1966.     FreeSignal(signalNum)
  1967.            D0
  1968.  
  1969.     FreeSignal(ULONG);
  1970.  
  1971.    FUNCTION
  1972.     This function frees a previously allocated signal bit for reuse.
  1973.     This call must be performed while running in the same task in which
  1974.     the signal was allocated.
  1975.  
  1976.    WARNING
  1977.     Signals may not be allocated or freed from exception handling code.
  1978.  
  1979.    INPUTS
  1980.     signalNum - the signal number to free {0..31}
  1981.  
  1982. exec.library/FreeTrap                       exec.library/FreeTrap
  1983.  
  1984.    NAME
  1985.     FreeTrap -- free a processor trap
  1986.  
  1987.    SYNOPSIS
  1988.     FreeTrap(trapNum)
  1989.          D0
  1990.  
  1991.     void FreeTrap(ULONG);
  1992.  
  1993.    FUNCTION
  1994.     This function frees a previously allocated trap number for reuse.
  1995.     This call must be performed while running in the same task in which
  1996.     the trap was allocated.
  1997.  
  1998.    WARNING
  1999.     Traps may not be allocated or freed from exception handling code.
  2000.  
  2001.    INPUTS
  2002.     trapNum - the trap number to free {of 0..15}
  2003.  
  2004. exec.library/FreeVec                    exec.library/FreeVec
  2005.  
  2006.    NAME
  2007.     FreeVec -- return AllocVec() memory to the system  (V36)
  2008.  
  2009.    SYNOPSIS
  2010.     FreeVec(memoryBlock)
  2011.         A1
  2012.  
  2013.     void FreeVec(void *);
  2014.  
  2015.    FUNCTION
  2016.     Free an allocation made by the AllocVec() call.  The memory will
  2017.     be returned to the system pool from which it came. 
  2018.  
  2019.    NOTE
  2020.     If a block of memory is freed twice, the system will Guru. The
  2021.     Alert is AN_FreeTwice ($01000009).   If you pass the wrong pointer,
  2022.     you will probably see AN_MemCorrupt $01000005.  Future versions may
  2023.     add more sanity checks to the memory lists.
  2024.  
  2025.    INPUTS
  2026.     memoryBlock - pointer to the memory block to free
  2027.  
  2028.    SEE ALSO
  2029.     AllocVec
  2030.  
  2031. exec.library/GetCC                      exec.library/GetCC
  2032.  
  2033.    NAME
  2034.     GetCC -- get condition codes in a 68010 compatible way.
  2035.  
  2036.    SYNOPSIS
  2037.     conditions = GetCC()
  2038.       D0
  2039.  
  2040.     UWORD = GetCC(void);
  2041.  
  2042.    FUNCTION
  2043.     The 68000 processor has a "MOVE SR,<ea>" instruction which gets a
  2044.     copy of the processor condition codes.
  2045.  
  2046.     On the 68010,20 and 30 CPUs, "MOVE SR,<ea>" is privileged.  User
  2047.     code will trap if it is attempted.  These processors need to use
  2048.     the "MOVE CCR,<ea>" instruction instead.
  2049.  
  2050.     This function provides a means of obtaining the CPU condition codes
  2051.     in a manner that will make upgrades transparent.  This function is
  2052.     very short and quick.
  2053.  
  2054.    RESULTS
  2055.     conditions - the 680XX condition codes
  2056.  
  2057. exec.library/GetMsg                     exec.library/GetMsg
  2058.  
  2059.    NAME
  2060.     GetMsg -- get next message from a message port
  2061.  
  2062.    SYNOPSIS
  2063.     message = GetMsg(port)
  2064.     D0         A0
  2065.  
  2066.     struct Message *GetMsg(struct MsgPort *);
  2067.  
  2068.    FUNCTION
  2069.     This function receives a message from a given message port. It
  2070.     provides a fast, non-copying message receiving mechanism. The
  2071.     received message is removed from the message port.
  2072.  
  2073.     This function will not wait.  If a message is not present this
  2074.     function will return zero.  If a program must wait for a message,
  2075.     it can Wait() on the signal specified for the port or use the
  2076.     WaitPort() function.  There can only be one task waiting for any
  2077.     given port.
  2078.  
  2079.     Getting a message does not imply to the sender that the message is
  2080.     free to be reused by the sender.  When the receiver is finished
  2081.     with the message, it may ReplyMsg() it back to the sender.
  2082.  
  2083.  
  2084.     Getting a signal does NOT always imply a message is ready.  More
  2085.     than one message may arrive per signal, and signals may show up
  2086.     without messages.  Typically you must loop to GetMsg() until it
  2087.     returns zero, then Wait() or WaitPort().
  2088.  
  2089.    INPUT
  2090.     port - a pointer to the receiver message port
  2091.  
  2092.    RESULT
  2093.     message - a pointer to the first message available.  If
  2094.           there are no messages, return zero.
  2095.           Callers must be prepared for zero at any time.
  2096.  
  2097.    SEE ALSO
  2098.     PutMsg, ReplyMsg, WaitPort, Wait, exec/ports.h
  2099.  
  2100. exec.library/InitCode                                     exec.library/InitCode
  2101.  
  2102.    NAME
  2103.     InitCode - initialize resident code modules (internal function)
  2104.  
  2105.    SYNOPSIS
  2106.     InitCode(startClass, version)
  2107.          D0          D1
  2108.  
  2109.    FUNCTION
  2110.     (This function may be ignored by application programmers)
  2111.  
  2112.     Call InitResident() for all resident modules in the ResModules array
  2113.     with the given startClass and with versions equal or greater than 
  2114.     that specified.  The segList parameter is passed as zero.
  2115.  
  2116.     Resident modules are used by the system to pull all its parts
  2117.     together at startup.  Modules are initialized in a prioritized order.
  2118.  
  2119.     Modules that do not have a startclass should be of priority -120.
  2120.     RTF_AFTERDOS modues should start at -100 (working down).
  2121.  
  2122.    INPUTS
  2123.     startClass - the class of code to be initialized:
  2124.         BITDEF RT,COLDSTART,0
  2125.         BITDEF RT,SINGLETASK,1    ;ExecBase->ThisTask==0 (V36 only)
  2126.         BITDEF RT,AFTERDOS,2    ;(V36 only)
  2127.     version - a major version number
  2128.  
  2129.     SEE ALSO
  2130.     ResidentTag (RT) structure definition (resident.h)
  2131.  
  2132. exec.library/InitResident               exec.library/InitResident
  2133.  
  2134.    NAME
  2135.     InitResident - initialize resident module
  2136.  
  2137.    SYNOPSIS
  2138.     InitResident(resident, segList)
  2139.              A1        D1
  2140.     void InitResident(struct Resident *,ULONG);
  2141.  
  2142.    FUNCTION
  2143.     Initialize a ROMTag.  ROMTags are used to link system modules
  2144.     together.  Each disk based device or library must contain a
  2145.     ROMTag structure in the first code hunk.
  2146.  
  2147.     Once the validity of the ROMTag is verified, the RT_INIT pointer
  2148.     is jumped to  with the following registers:
  2149.         D0 = 0
  2150.         A0 = segList
  2151.          A6 = ExecBase
  2152.  
  2153.    AUTOINIT FEATURE
  2154.     An automatic method of library/device base and vector table
  2155.     initialization is also provided by InitResident().  The initial code
  2156.     hunk of the library or device should contain "MOVEQ #-1,d0; RTS;".
  2157.     Following that must be an initialized Resident structure with 
  2158.     RTF_AUTOINIT set in rt_Flags, and an rt_Init pointer which points
  2159.     to four longwords.  These four longwords will be used in a call
  2160.     to MakeLibrary();
  2161.  
  2162.         - The size of your library/device base structure including initial
  2163.           Library or Device structure.
  2164.  
  2165.         - A pointer to a longword table of standard, then library
  2166.           specific function offsets, terminated with -1L.
  2167.           (short format offsets are also acceptable)
  2168.  
  2169.         - Pointer to data table in exec/InitStruct format for
  2170.           initialization of Library or Device structure.
  2171.  
  2172.         - Pointer to library initialization function, or NULL.
  2173.         Calling sequence:
  2174.             D0 = library base
  2175.             A0 = segList
  2176.             A6 = ExecBase
  2177.           This function must return in D0 the library/device base to be
  2178.           linked into the library/device list.  If the initialization
  2179.           function fails, the device memory must be manually deallocated,
  2180.           then NULL returned in D0.
  2181.  
  2182.    SEE ALSO
  2183.     exec/resident.i
  2184.  
  2185. exec.library/InitSemaphore              exec.library/InitSemaphore
  2186.  
  2187.    NAME
  2188.     InitSemaphore -- initialize a signal semaphore
  2189.  
  2190.    SYNOPSIS
  2191.     InitSemaphore(signalSemaphore)
  2192.               A0
  2193.  
  2194.     void InitSemaphore(struct SignalSemaphore *);
  2195.  
  2196.    FUNCTION
  2197.     This function initializes a signal semaphore and prepares it for
  2198.     use.  It does not allocate anything, but does initialize list
  2199.     pointers and the semaphore counters.
  2200.  
  2201.     Semaphores are often used to protect critical data structures
  2202.     or hardware that can only be accessed by one task at a time.
  2203.     After initialization, the address of the SignalSemaphore may be
  2204.     made available to any number of tasks.  Typically a task will
  2205.     try to ObtainSemaphore(), passing this address in.  If no other
  2206.     task owns the semaphore, then the call will lock and return
  2207.     quickly.  If more tasks try to ObtainSemaphore(), they will
  2208.     be put to sleep.  When the owner of the semaphore releases
  2209.     it, the next waiter in turn will be woken up.
  2210.  
  2211.     Semaphores are often preferable to the old-style Forbid()/Permit()
  2212.     type arbitration.  With Forbid()/Permit() *all* other tasks are 
  2213.     prevented from running.  With semaphores, only those tasks that
  2214.     need access to whatever the semaphore protects are subject
  2215.     to waiting.
  2216.  
  2217.    INPUT
  2218.     signalSemaphore -- a signal semaphore structure (with all fields
  2219.                set to zero before the call)
  2220.  
  2221.    SEE ALSO
  2222.     ObtainSemaphore(), ObtainSemaphoreShared(), AttemptSemaphore(),
  2223.     ReleaseSemaphore(), exec/semaphores.h
  2224.  
  2225. exec.library/InitStruct                  exec.library/InitStruct
  2226.  
  2227.    NAME
  2228.     InitStruct - initialize memory from a table
  2229.  
  2230.    SYNOPSIS
  2231.     InitStruct(initTable, memory, size);
  2232.            A1          A2      D0
  2233.  
  2234.     void InitStruct(struct InitStruct *, APTR, ULONG);
  2235.  
  2236.    FUNCTION
  2237.     Clear a memory area, then set up default values according to
  2238.     the data and offset values in the initTable.  Typically only assembly
  2239.     programs take advantage of this function, and only with the macros
  2240.     defined in "exec/initializers.i".
  2241.  
  2242.     The initialization table has byte commands to
  2243.  
  2244.          |a    ||byte|    |given||byte|          |once        |
  2245.     load |count||word| into |next ||rptr| offset, |repetitively |
  2246.             |long|
  2247.  
  2248.     Not all combinations are supported.  The offset, when specified, is
  2249.     relative to the memory pointer provided (Memory), and is initially
  2250.     zero.  The initialization data (InitTable) contains byte commands
  2251.     whose 8 bits are interpreted as follows:
  2252.  
  2253.     ddssnnnn
  2254.         dd    the destination type (and size):
  2255.         00  no offset, use next destination, nnnn is count
  2256.         01  no offset, use next destination, nnnn is repeat
  2257.         10  destination offset is in the next byte, nnnn is count
  2258.         11  destination offset is in the next 24-bits, nnnn is count
  2259.         ss    the size and location of the source:
  2260.         00  long, from the next two aligned words
  2261.         01  word, from the next aligned word
  2262.         10  byte, from the next byte
  2263.         11  ERROR - will cause an ALERT (see below)
  2264.       nnnn    the count or repeat:
  2265.          count  the (number+1) of source items to copy
  2266.         repeat  the source is copied (number+1) times.
  2267.  
  2268.     initTable commands are always read from the next even byte. Given
  2269.     destination offsets are always relative to the memory pointer (A2).
  2270.  
  2271.     The command %00000000 ends the InitTable stream: use %00010001 if you
  2272.     really want to copy one longword without a new offset.
  2273.  
  2274.     24 bit APTR not supported for 68020 compatibility -- use long.
  2275.  
  2276.    INPUTS
  2277.     initTable - the beginning of the commands and data to init
  2278.         Memory with.  Must be on an even boundary unless only
  2279.         byte initialization is done.  End table with "dc.b 0"
  2280.         or "dc.w 0".
  2281.     memory - the beginning of the memory to initialize.  Must be
  2282.         on an even boundary if size is specified.
  2283.     size - the size of memory, which is used to clear it before
  2284.         initializing it via the initTable.  If Size is zero,
  2285.         memory is not cleared before initializing.
  2286.  
  2287.         size must be an even number.
  2288.  
  2289.     SEE ALSO
  2290.     exec/initializers.i
  2291.  
  2292. exec.library/Insert                     exec.library/Insert
  2293.  
  2294.    NAME
  2295.     Insert -- insert a node into a list
  2296.  
  2297.    SYNOPSIS
  2298.     Insert(list, node, listNode)
  2299.            A0    A1    A2
  2300.  
  2301.     void Insert(struct List *, struct Node *, struct Node *);
  2302.  
  2303.    FUNCTION
  2304.     Insert a node into a doubly linked list AFTER a given node
  2305.     position.  Insertion at the head of a list is possible by passing a
  2306.     zero value for listNode, though the AddHead function is slightly
  2307.     faster for that special case.
  2308.  
  2309.    WARNING
  2310.     This function does not arbitrate for access to the list.  The
  2311.     calling task must be the owner of the involved list.
  2312.  
  2313.    INPUTS
  2314.     list - a pointer to the target list header
  2315.     node - the node to insert
  2316.     listNode - the node after which to insert
  2317.  
  2318.     SEE ALSO
  2319.     AddHead, AddTail, Enqueue, RemHead, Remove, RemTail
  2320.  
  2321. exec.library/MakeFunctions              exec.library/MakeFunctions
  2322.  
  2323.    NAME
  2324.     MakeFunctions -- construct a function jump table
  2325.  
  2326.    SYNOPSIS
  2327.     tableSize = MakeFunctions(target, functionArray, funcDispBase)
  2328.     D0              A0      A1         A2
  2329.  
  2330.     ULONG MakeFunctions(APTR,APTR,APTR);
  2331.  
  2332.    FUNCTION
  2333.     A low level function used by MakeLibrary to build jump tables of
  2334.     the type used by libraries, devices and resources.  It allows the
  2335.     table to be built anywhere in memory, and can be used both for
  2336.     initialization and replacement. This function also supports function
  2337.     pointer compression by expanding relative displacements into absolute
  2338.     pointers.
  2339.  
  2340.    INPUT
  2341.     destination - the target address for the high memory end of the
  2342.         function jump table.  Typically this will be the library
  2343.         base pointer.
  2344.  
  2345.     functionArray - pointer to an array of function pointers or
  2346.         function displacements.  If funcDispBase is zero, the array
  2347.         is assumed to contain absolute pointers to functions. If
  2348.         funcDispBase is not zero, then the array is assumed to
  2349.         contain word displacements to functions.  In both cases,
  2350.         the array is terminated by a -1 (of the same size as the
  2351.         actual entry.
  2352.  
  2353.     funcDispBase - pointer to the base about which all function
  2354.         displacements are relative.  If zero, then the function
  2355.         array contains absolute pointers.
  2356.  
  2357.    RESULT
  2358.     tableSize - size of the new table in bytes (for LIB_NEGSIZE).
  2359.  
  2360.    SEE ALSO
  2361.     exec/MakeLibrary
  2362.  
  2363. exec.library/MakeLibrary                exec.library/MakeLibrary
  2364.  
  2365.    NAME
  2366.     MakeLibrary -- construct a library
  2367.  
  2368.    SYNOPSIS
  2369.     library = MakeLibrary(vectors, structure, init, dSize, segList)
  2370.     D0              A0       A1      A2    D0     D1
  2371.  
  2372.     struct Library *MakeLibrary
  2373.                   (APTR,struct InitStruct *,APTR,ULONG,BPTR);
  2374.  
  2375.    FUNCTION
  2376.     This function is used for constructing a library vector and data
  2377.     area.  The same call is used to make devices.  Space for the library
  2378.     is allocated from the system's free memory pool.  Starting with V36,
  2379.     the library base is longword adjusted.  The lib_PosSize and
  2380.     lib_NegSize fields of the library structure are filled.  The data
  2381.     portion of the library is initialized.  init may point to a library
  2382.     specific entry point.
  2383.  
  2384.    INPUTS
  2385.     vectors - pointer to an array of function pointers or function
  2386.         displacements.    If the first word of the array is -1, then
  2387.         the array contains relative word displacements (based off
  2388.         of vectors); otherwise, the array contains absolute
  2389.         function pointers. The vector list is terminated by a -1
  2390.         (of the same size as the pointers).
  2391.  
  2392.     structure - points to an "InitStruct" data region.  If NULL,
  2393.         then it will not be used.
  2394.  
  2395.     init -    If non-NULL, an entry point that will be called before adding
  2396.         the library to the system.  Registers are as follows:
  2397.             d0 = libAddr     ;Your Library Address
  2398.             a0 = segList    ;Your AmigaDOS segment list
  2399.             a6 = ExecBase    ;Address of exec.library
  2400.         The result of the init function must be the library address,
  2401.         or NULL for failure.   If NULL, the init point must manually
  2402.         deallocate the library base memory (based on the sizes stored
  2403.         in lib_PosSize and lib_NegSize).
  2404.  
  2405.     dSize - the size of the library data area, including the
  2406.         standard library node data.  This must be at leas
  2407.         sizeof(struct Library).
  2408.  
  2409.         segList - pointer to an AmigaDOS SegList (segment list).
  2410.          This is passed to a library's init code, and is used later
  2411.          for removing the library from memory.
  2412.  
  2413.    RESULT
  2414.     library - the reference address of the library.  This is the
  2415.           address used in references to the library, not the
  2416.           beginning of the memory area allocated.  If the library
  2417.           vector table require more system memory than is
  2418.           available, this function will return NULL.
  2419.  
  2420.    SEE ALSO
  2421.     InitStruct, InitResident, exec/initializers.i
  2422.  
  2423. exec.library/ObtainSemaphore            exec.library/ObtainSemaphore
  2424.  
  2425.    NAME
  2426.     ObtainSemaphore -- gain exclusive access to a semaphore
  2427.  
  2428.    SYNOPSIS
  2429.     ObtainSemaphore(signalSemaphore)
  2430.             A0
  2431.  
  2432.     void ObtainSemaphore(struct SignalSemaphore *);
  2433.  
  2434.    FUNCTION
  2435.     Signal semaphores are used to gain exclusive access to an object.
  2436.     ObtainSemaphore is the call used to gain this access.  If another
  2437.     user currently has the semaphore locked the call will block until
  2438.     the object is available.
  2439.  
  2440.     If the current task already has locked the semaphore and attempts to
  2441.     lock it again the call will still succeed.  A "nesting count" is
  2442.     incremented each time the current owning task of the semaphore calls
  2443.     ObtainSemaphore().  This counter is decremented each time
  2444.     ReleaseSemaphore() is called.  When the counter returns to zero the
  2445.     semaphore is actually released, and the next waiting task is called.
  2446.  
  2447.     A queue of waiting tasks is maintained on the stacks of the waiting
  2448.     tasks.    Each will be called in turn as soon as the current task
  2449.     releases the semaphore.
  2450.  
  2451.     Signal Semaphores are different than Procure()/Vacate() semaphores.
  2452.     The former requires less CPU time, especially if the semaphore is
  2453.     not currently locked.  They require very little set up and user
  2454.     thought.  The latter flavor of semaphore make no assumptions about
  2455.     how they are used -- they are completely general.  Unfortunately
  2456.     they are not as efficient as signal semaphores, and require the
  2457.     locker to have done some setup before doing the call.
  2458.  
  2459.    INPUT
  2460.        signalSemaphore -- an initialized signal semaphore structure
  2461.  
  2462.    SEE ALSO
  2463.     ObtainSemaphoreShared(), InitSemaphore(), ReleaseSemaphore(),
  2464.     AttemptSemaphore(), ObtainSemaphoreList()
  2465.  
  2466. exec.library/ObtainSemaphoreShared        exec.library/ObtainSemaphoreShared
  2467.  
  2468.     NAME
  2469.     ObtainSemaphoreShared -- gain shared access to a semaphore (V36)
  2470.  
  2471.     SYNOPSIS
  2472.     ObtainSemaphoreShared(signalSemaphore)
  2473.                           a0
  2474.  
  2475.     FUNCTION
  2476.     A lock on a signal semaphore may either be exclusive, or shared.
  2477.     Exclusive locks are granted by the ObtainSemaphore() and
  2478.     AttemptSemaphore() functions.  Shared locks are granted by
  2479.     ObtainSemaphoreShared().  Calls may be nested.
  2480.  
  2481.     Any number of tasks may simultaneously hold a shared lock on a 
  2482.     semaphore.  Only one task may hold an exclusive lock.  A typical
  2483.     application is a list that is often read, but only occasionally
  2484.     written to.
  2485.  
  2486.     Any exlusive locker will be held off until all shared lockers
  2487.     release the semaphore.  Likewise, if an exlusive lock is held,
  2488.     all potential shared lockers will block until the exclusive lock
  2489.     is released.  All shared lockers are restarted at the same time.
  2490.  
  2491.     EXAMPLE
  2492.         ObtainSemaphoreShared(ss);
  2493.         /* read data */
  2494.         ReleaseSemaohore(ss);
  2495.  
  2496.         ObtainSemaphore(ss);
  2497.         /* modify data */
  2498.         ReleaseSemaohore(ss);
  2499.  
  2500.     NOTE
  2501.     While this funciton was added for V36, the feature magically works
  2502.     with all older semaphore structures.
  2503.  
  2504.     INPUT
  2505.     signalSemaphore -- an initialized signal semaphore structure
  2506.  
  2507.     RESULT
  2508.  
  2509.     SEE ALSO
  2510.     InitSemaphore(), ReleaseSemaphore()
  2511.  
  2512. exec.library/ObtainSemaphoreList        exec.library/ObtainSemaphoreList
  2513.  
  2514.    NAME
  2515.     ObtainSemaphoreList -- get a list of semaphores.
  2516.  
  2517.    SYNOPSIS
  2518.     ObtainSemaphoreList(list)
  2519.                 A0
  2520.  
  2521.     void ObtainSemaphoreList(struct List *);
  2522.  
  2523.    FUNCTION
  2524.     Signal semaphores may be linked together into a list. This function
  2525.     takes a list of these semaphores and attempts to lock all of them at
  2526.     once. This call is preferable to applying ObtainSemaphore() to each
  2527.     element in the list because it attempts to lock all the elements
  2528.     simultaneously, and won't deadlock if someone is attempting to lock
  2529.     in some other order.
  2530.  
  2531.     This function assumes that only one task at a time will attempt to
  2532.     lock the entire list of semaphores.  In other words, there needs to
  2533.     be a higher level lock (perhaps another signal semaphore...) that is
  2534.     used before someone attempts to lock the semaphore list via
  2535.     ObtainSemaphoreList().
  2536.  
  2537.     Note that deadlocks may result if this call is used AND someone
  2538.     attempts to use ObtainSemaphore() to lock more than one semaphore on
  2539.     the list.  If you wish to lock more than semaphore (but not all of
  2540.     them) then you should obtain the higher level lock (see above)
  2541.  
  2542.    INPUT
  2543.        list -- a list of signal semaphores
  2544.  
  2545.    SEE ALSO
  2546.     InitSemaphore(), ReleaseSemaphoreList()
  2547.  
  2548. exec.library/OldOpenLibrary             exec.library/OldOpenLibrary
  2549.  
  2550.    NAME
  2551.     OldOpenLibrary -- obsolete OpenLibrary
  2552.  
  2553.    SYNOPSIS
  2554.     library = OldOpenLibrary(libName)
  2555.     D0             A1
  2556.  
  2557.     struct Library *OldOpenLibrary(APTR);
  2558.  
  2559.    FUNCTION
  2560.     The 1.0 release of the Amiga system had an incorrect version of
  2561.     OpenLibrary that did not check the version number during the
  2562.     library open.  This obsolete function is provided so that object
  2563.     code compiled using a 1.0 system will still run.
  2564.  
  2565.     This exactly the same as "OpenLibrary(libName,0L);"
  2566.  
  2567.    INPUTS
  2568.     libName - the name of the library to open
  2569.  
  2570.    RESULTS
  2571.     library - a library pointer for a successful open, else zero
  2572.  
  2573.    SEE ALSO
  2574.     CloseLibrary
  2575.  
  2576. exec.library/OpenDevice                  exec.library/OpenDevice
  2577.  
  2578.    NAME
  2579.     OpenDevice -- gain access to a device
  2580.  
  2581.    SYNOPSIS
  2582.     error = OpenDevice(devName, unitNumber, iORequest, flags)
  2583.     D0           A0        D0        A1       D1
  2584.  
  2585.     BYTE OpenDevice(STRPTR,ULONG,struct IORequest *,ULONG);
  2586.  
  2587.    FUNCTION
  2588.     This function opens the named device/unit and initializes the given
  2589.     I/O request block.  Specific documentation on opening procedures
  2590.     may come with certain devices.
  2591.  
  2592.     The device may exist in memory, or on disk; this is transparent to
  2593.     the OpenDevice caller.
  2594.  
  2595.     A full path name for the device name is legitimate.  For example
  2596.     "test:devs/fred.device".  This allows the use of custom devices
  2597.     without requiring the user to copy the device into the system's
  2598.     DEVS: directory.
  2599.  
  2600.    NOTE
  2601.     All calls to OpenDevice should have matching calls to CloseDevice!
  2602.  
  2603.    INPUTS
  2604.     devName - requested device name
  2605.  
  2606.     unitNumber - the unit number to open on that device.  The format of
  2607.         the unit number is device specific.  If the device does
  2608.         not have separate units, send a zero.
  2609.  
  2610.     iORequest - the I/O request block to be returned with
  2611.         appropriate fields initialized.
  2612.  
  2613.     flags - additional driver specific information.  This is sometimes
  2614.         used to request opening a device with exclusive access.
  2615.  
  2616.    RESULTS
  2617.     error - Returns a sign-extended copy of the io_Error field
  2618.         of the IORequest.  Zero if successful, else an error code
  2619.         is returned.
  2620.  
  2621.    BUGS
  2622.     AmigaDOS file names are not case sensitive, but Exec lists are.  If
  2623.     the library name is specified in a different case than it exists on
  2624.     disk, unexpected results may occur.
  2625.  
  2626.     Tasks should not be allowed to make OpenDevice calls that will
  2627.     cause the device to be loaded from disk (since tasks are not
  2628.     allowed to make dos.library calls).
  2629.  
  2630.    SEE ALSO
  2631.     CloseDevice, DoIO, SendIO, CheckIO, AbortIO, WaitIO
  2632.  
  2633. exec.library/OpenLibrary                exec.library/OpenLibrary
  2634.  
  2635.    NAME
  2636.     OpenLibrary -- gain access to a library
  2637.  
  2638.    SYNOPSIS
  2639.     library = OpenLibrary(libName, version)
  2640.     D0              A1       D0
  2641.  
  2642.     struct Library *OpenLibrary(STRPTR,ULONG);
  2643.  
  2644.    FUNCTION
  2645.     This function returns a pointer to a library that was previously
  2646.     installed into the system.  If the requested library is exists, and
  2647.     if the library version is greater than or equal to the requested
  2648.     version, then the open will succeed.
  2649.  
  2650.     The device may exist in memory, or on disk; this is transparent to
  2651.     the OpenDevice caller.  Only Processes are allowed to call
  2652.     OpenLibrary (since OpenLibrary may in turn call dos.library).
  2653.  
  2654.     A full path name for the library name is legitimate.  For example
  2655.     "wp:libs/wp.library".  This allows the use of custom libraries
  2656.     without requiring the user to copy the library into the system's
  2657.     LIBS: directory.
  2658.  
  2659.    NOTE
  2660.     All calls to OpenLibrary should have matching calls to CloseLibrary!
  2661.  
  2662.    INPUTS
  2663.     libName - the name of the library to open
  2664.  
  2665.     version - the version of the library required.
  2666.  
  2667.    RESULTS
  2668.     library - a library pointer for a successful open, else zero
  2669.  
  2670.    BUGS
  2671.     AmigaDOS file names are not case sensitive, but Exec lists are. If
  2672.     the library name is specified in a different case than it exists on
  2673.     disk, unexpected results may occur.
  2674.  
  2675.     Tasks should not be allowed to make OpenLibrary calls that will
  2676.     cause the library to be loaded from disk (since tasks are not
  2677.     allowed to make dos.library requests).
  2678.  
  2679.    SEE ALSO
  2680.     CloseLibrary
  2681.  
  2682. exec.library/OpenResource               exec.library/OpenResource
  2683.  
  2684.    NAME
  2685.     OpenResource -- gain access to a resource
  2686.  
  2687.    SYNOPSIS
  2688.     resource = OpenResource(resName)
  2689.     D0            A1
  2690.  
  2691.     APTR OpenResource(STRPTR);
  2692.  
  2693.    FUNCTION
  2694.     This function returns a pointer to a resource that was previously
  2695.     installed into the system.
  2696.  
  2697.     There is no CloseResource() function.
  2698.  
  2699.    INPUTS
  2700.        resName - the name of the resource requested.
  2701.  
  2702.    RESULTS
  2703.     resource - if successful, a resource pointer, else NULL
  2704.  
  2705. exec.library/Permit                      exec.library/Permit
  2706.  
  2707.     NAME
  2708.     Permit -- permit task rescheduling.
  2709.  
  2710.     SYNOPSIS
  2711.     Permit()
  2712.  
  2713.     void Permit(void);
  2714.  
  2715.     FUNCTION
  2716.     Allow other tasks to be scheduled to run by the dispatcher, after a
  2717.     matching Forbid() has been executed.
  2718.  
  2719.     RESULTS
  2720.     Other tasks will be rescheduled as they are ready to run. In order
  2721.     to restore normal task rescheduling, the programmer must execute
  2722.     exactly one call to Permit() for every call to Forbid().
  2723.  
  2724.     NOTE
  2725.     This call is guaranteed to preserve all registers.
  2726.  
  2727.     SEE ALSO
  2728.     Forbid, Disable, Enable
  2729.  
  2730. exec.library/Procure                     exec.library/Procure
  2731.  
  2732.    NAME
  2733.     Procure -- bid for a message lock (semaphore)
  2734.  
  2735.    SYNOPSIS
  2736.     result = Procure(semaphore, bidMessage)
  2737.     D0         A0        A1
  2738.  
  2739.     BYTE Procure(struct Semaphore *, struct Message *);
  2740.  
  2741.    FUNCTION
  2742.     This function is used to obtain a message based semaphore lock.  If
  2743.     the lock is immediate, Procure() returns a true result, and the
  2744.     bidMessage is not used.   If the semaphore is already locked,
  2745.     Procure() returns false, and the task must wait for the bidMessage
  2746.     to arrive at its reply port.
  2747.  
  2748.     Straight "Semaphores" use the message system.  They are therefore
  2749.     queueable, and users may wait on several of them at the same time.
  2750.     This makes them more powerful than "Signal Semaphores"
  2751.  
  2752.    INPUT
  2753.     semaphore - a semaphore message port.  This port is used to queue
  2754.     all pending lockers.  This port should be initialized with the
  2755.     PA_IGNORE option, as the MP_SigTask field is used for a pointer to
  2756.     the current locker message (not a task). New semaphore ports must
  2757.     also have the SM_BIDS word initialized to -1.  If the semaphore is
  2758.     public, it should be named, its priority set, and the added with
  2759.     AddPort. Message port priority is often used for anti-deadlock
  2760.     locking conventions.
  2761.  
  2762.    RESULT
  2763.     result - true when the semaphore is free.  In such cases no waiting
  2764.     needs to be done.  If false, then the task should wait at its
  2765.     bidMessage reply port.
  2766.  
  2767.    BUGS
  2768.     Procure() and Vacate() do not have proven reliability.
  2769.  
  2770.    SEE ALSO
  2771.     Vacate()
  2772.  
  2773. exec.library/PutMsg                      exec.library/PutMsg
  2774.  
  2775.    NAME
  2776.     PutMsg -- put a message to a message port
  2777.  
  2778.    SYNOPSIS
  2779.     PutMsg(port, message)
  2780.            A0    A1
  2781.  
  2782.     void PutMsg(struct MsgPort *, struct Message *);
  2783.  
  2784.    FUNCTION
  2785.     This function attaches a message to the end of a given message port.
  2786.     It provides a fast, non-copying message sending mechanism.
  2787.  
  2788.     Messages can be attached to only one port at a time.  The message
  2789.     body can be of any size or form.  Because messages are not copied,
  2790.     cooperating tasks share the same message memory.  The sender task
  2791.     must not recycle the message until it has been replied by the
  2792.     receiver.  Of course this depends on the message handling conventions
  2793.     setup by the involved tasks.  If the ReplyPort field is non-zero,
  2794.     when the message is replied by the receiver, it will be sent back to
  2795.     that port.
  2796.  
  2797.     Any one of the following actions can be set to occur when a message
  2798.     is put:
  2799.  
  2800.         1. no special action
  2801.         2. signal a given task (specified by MP_SIGTASK)
  2802.         3. cause a software interrupt (specified by MP_SIGTASK)
  2803.  
  2804.     The action is selected depending on the value found in the MP_FLAGS
  2805.     of the destination port.
  2806.  
  2807.    IMPLEMENTATION
  2808.     1.  Sets the LN_TYPE field to "NT_MESSAGE".
  2809.     2.  Attaches the message to the destination port.
  2810.     3.  Performs the specified arrival action at the destination.
  2811.  
  2812.    INPUT
  2813.     port - pointer to a message port
  2814.     message - pointer to a message
  2815.  
  2816.    SEE ALSO
  2817.     GetMsg, ReplyMsg, exec/ports.h
  2818.  
  2819. exec.library/RawDoFmt                                     exec.library/RawDoFmt
  2820.  
  2821.    NAME
  2822.     RawDoFmt -- format data into a character stream.
  2823.  
  2824.    SYNOPSIS
  2825.     RawDoFmt(FormatString, DataStream, PutChProc, PutChData);
  2826.                  a0            a1          a2         a3
  2827.  
  2828.     void RawDoFmt(STRPTR,APTR,void (*)(),APTR);
  2829.  
  2830.    FUNCTION
  2831.     perform "C"-language-like formatting of a data stream, outputting
  2832.     the result a character at a time.  Where % formatting commands are
  2833.     found in the FormatString, they will be replaced with the
  2834.     corresponding element in the DataStream.  %% must be used in the
  2835.     string if a % is desired in the output.
  2836.  
  2837.     Under V36, RawDoFmt() returns a pointer to the end of the DataStream
  2838.     (The next argument that would have been processed).  This allows
  2839.     multiple formatting passes to be made using the same data.
  2840.  
  2841.    INPUTS
  2842.     FormatString - a "C"-language-like NULL terminated format string,
  2843.     with the following supported % options:
  2844.  
  2845.      %[flags][width.limit][length]type
  2846.  
  2847.     flags  - only one allowed. '-' specifies left justification.
  2848.     width  - field width.  If the first character is a '0', the
  2849.          field will be padded with leading 0's.
  2850.       .    - must follow the field width, if specified
  2851.     limit  - maximum number of characters to output from a string.
  2852.          (only valid for %s).
  2853.     length - size of input data defaults to WORD for types d, x,
  2854.          and c, 'l' changes this to long (32-bit).
  2855.     type   - supported types are:
  2856.             b - BSTR, data is 32-bit BPTR to byte count followed
  2857.                 by a byte string, or NULL terminated byte string.
  2858.                 A NULL BPTR is treated as an empty string.
  2859.                 (Added in V36 exec)
  2860.             d - decimal
  2861.             x - hexadecimal
  2862.             s - string, a 32-bit pointer to a NULL terminated
  2863.                 byte string.  In V36, a NULL pointer is treated
  2864.                 as an empty string
  2865.             c - character
  2866.  
  2867.     DataStream - a stream of data that is interpreted according to
  2868.          the format string.  Often this is a pointer into
  2869.          the task's stack.
  2870.     PutChProc  - the procedure to call with each character to be
  2871.          output, called as:
  2872.  
  2873.     PutChProc(Char,  PutChData);
  2874.           D0-0:8 A3
  2875.  
  2876.         the procedure is called with a NULL Char at the end of
  2877.         the format string.
  2878.  
  2879.     PutChData - a value that is passed through to the PutChProc
  2880.         procedure.  This is untouched by RawDoFmt, and may be
  2881.         modified by the PutChProc.
  2882.  
  2883.    EXAMPLE
  2884.     ;
  2885.     ; Simple version of the C "sprintf" function.  Assumes C-style
  2886.     ; stack-based function conventions.
  2887.     ;
  2888.     ;   long eyecount;
  2889.     ;   eyecount=2;
  2890.     ;   sprintf(string,"%s have %ld eyes.","Fish",eyecount);
  2891.     ;
  2892.     ; would produce "Fish have 2 eyes." in the string buffer.
  2893.     ;
  2894.         XDEF _sprintf
  2895.         XREF _AbsExecBase
  2896.         XREF _LVORawDoFmt
  2897.     _sprintf:    ; ( ostring, format, {values} )
  2898.         movem.l a2/a3/a6,-(sp)
  2899.  
  2900.         move.l    4*4(sp),a3       ;Get the output string pointer
  2901.         move.l    5*4(sp),a0       ;Get the FormatString pointer
  2902.         lea.l    6*4(sp),a1       ;Get the pointer to the DataStream
  2903.         lea.l    stuffChar(pc),a2
  2904.         move.l    _AbsExecBase,a6
  2905.         jsr    _LVORawDoFmt(a6)
  2906.  
  2907.         movem.l (sp)+,a2/a3/a6
  2908.         rts
  2909.  
  2910.     ;------ PutChProc function used by RawDoFmt -----------
  2911.     stuffChar:
  2912.         move.b    d0,(a3)+        ;Put data to output string
  2913.         rts
  2914.  
  2915.    WARNING
  2916.     This Amiga ROM function formats word values in the data stream.  If
  2917.     your compiler defaults to longs, you must add an "l" to your
  2918.     % specifications.  This can get strange for characters, which might
  2919.     look like "%lc".
  2920.  
  2921.    SEE ALSO
  2922.     Documentation on the C language "printf" call in any C language
  2923.     reference book.
  2924.  
  2925. exec.library/ReleaseSemaphore               exec.library/ReleaseSemaphore
  2926.  
  2927.    NAME
  2928.     ReleaseSemaphore -- make signal semaphore available to others
  2929.  
  2930.    SYNOPSIS
  2931.     ReleaseSemaphore(signalSemaphore)
  2932.              A0
  2933.  
  2934.     void ReleaseSemaphore(struct SignalSemaphore *);
  2935.  
  2936.    FUNCTION
  2937.     ReleaseSemaphore() is the inverse of ObtainSemaphore(). It makes
  2938.     the semaphore lockable to other users.    If tasks are waiting for
  2939.     the semaphore and this this task is done with the semaphore then
  2940.     the next waiting task is signalled.
  2941.  
  2942.     Each ObtainSemaphore() call must be balanced by exactly one
  2943.     ReleaseSemaphore() call.  This is because there is a nesting count
  2944.     maintained in the semaphore of the number of times that the current
  2945.     task has locked the semaphore. The semaphore is not released to
  2946.     other tasks until the number of releases matches the number of
  2947.     obtains.
  2948.  
  2949.     Needless to say, havoc breaks out if the task releases more times
  2950.     than it has obtained.
  2951.  
  2952.    INPUT
  2953.        signalSemaphore -- an initialized signal semaphore structure
  2954.  
  2955.    SEE ALSO
  2956.     InitSemaphore(), ObtainSemaphore(), ObtainSemaphoreShared()
  2957.  
  2958. exec.library/ReleaseSemaphoreList       exec.library/ReleaseSemaphoreList
  2959.  
  2960.    NAME
  2961.     ReleaseSemaphoreList -- make a list of semaphores available
  2962.  
  2963.    SYNOPSIS
  2964.     ReleaseSemaphoreList(list)
  2965.                  A0
  2966.     void ReleaseSemaphoreList(struct List *);
  2967.  
  2968.    FUNCTION
  2969.     ReleaseSemaphoreList() is the inverse of ObtainSemaphoreList(). It
  2970.     releases each element in the semaphore list.
  2971.  
  2972.     Needless to say, havoc breaks out if the task releases more times
  2973.     than it has obtained.
  2974.  
  2975.    INPUT
  2976.        list -- a list of signal semaphores
  2977.  
  2978.    SEE ALSO
  2979.     ObtainSemaphoreList()
  2980.  
  2981. exec.library/RemDevice                      exec.library/RemDevice
  2982.  
  2983.    NAME
  2984.     RemDevice -- remove a device from the system
  2985.  
  2986.    SYNOPSIS
  2987.     void RemDevice(device)
  2988.                A1
  2989.  
  2990.     void RemDevice(struct Device *);
  2991.  
  2992.    FUNCTION
  2993.     This function calls the device's EXPUNGE vector, which requests
  2994.     that a device delete itself.  The device may refuse to do this if
  2995.     it is busy or currently open. This is not typically called by user
  2996.     code.
  2997.  
  2998.     There are certain, limited circumstances where it may be
  2999.     appropriate to attempt to specifically flush a certain device.
  3000.     Example:
  3001.  
  3002.      /* Attempts to flush the named device out of memory. */
  3003.      #include <exec/types.h>
  3004.      #include <exec/execbase.h>
  3005.  
  3006.      void FlushDevice(name)
  3007.      STRPTR name;
  3008.      {
  3009.      struct Device *result;
  3010.  
  3011.         Forbid();
  3012.         if(result=(struct Device *)FindName(&SysBase->DeviceList,name))
  3013.         RemDevice(result);
  3014.         Permit();
  3015.      }
  3016.  
  3017.    INPUTS
  3018.     device - pointer to a device node
  3019.  
  3020.    SEE ALSO
  3021.     AddLibrary
  3022.  
  3023. exec.library/RemHead                    exec.library/RemHead
  3024.  
  3025.    NAME
  3026.     RemHead -- remove the head node from a list
  3027.  
  3028.    SYNOPSIS
  3029.     node = RemHead(list)
  3030.     D0           A0
  3031.  
  3032.     struct Node *RemHead(struct List *);
  3033.  
  3034.    FUNCTION
  3035.     Get a pointer to the head node and remove it from the list.
  3036.     Assembly programmers may prefer to use the REMHEAD macro from
  3037.     "exec/lists.i".
  3038.  
  3039.    WARNING
  3040.     This function does not arbitrate for access to the list.  The
  3041.     calling task must be the owner of the involved list.
  3042.  
  3043.    INPUTS
  3044.     list - a pointer to the target list header
  3045.  
  3046.    RESULT
  3047.     node - the node removed or zero when empty list
  3048.  
  3049.    SEE ALSO
  3050.     AddHead, AddTail, Enqueue, Insert, Remove, RemTail
  3051.  
  3052. exec.library/RemIntServer               exec.library/RemIntServer
  3053.  
  3054.    NAME
  3055.     RemIntServer -- remove an interrupt server from a server chain
  3056.  
  3057.    SYNOPSIS
  3058.     RemIntServer(intNum, interrupt)
  3059.              D0      A1
  3060.  
  3061.     void RemIntServer(ULONG,struct Interrupt *);
  3062.  
  3063.    FUNCTION
  3064.     This function removes an interrupt server node from the given
  3065.     server chain.
  3066.  
  3067.     If this server was the last one on this chain, interrupts for this
  3068.     chain are disabled.
  3069.  
  3070.    INPUTS
  3071.     intNum - the Portia interrupt bit (0..14)
  3072.     interrupt - pointer to an interrupt server node
  3073.  
  3074.    BUGS
  3075.     Before V36 Kickstart, the feature that disables the interrupt
  3076.     would not function.  For most server chains this does not
  3077.     cause a problem.
  3078.  
  3079.    SEE ALSO
  3080.     AddIntServer, hardware/intbits.h
  3081.  
  3082. exec.library/RemLibrary                   exec.library/RemLibrary
  3083.  
  3084.    NAME
  3085.     RemLibrary -- remove a library from the system
  3086.  
  3087.    SYNOPSIS
  3088.     void RemLibrary(library)
  3089.            A1
  3090.  
  3091.     void RemLibrary(struct Library *);
  3092.  
  3093.    FUNCTION
  3094.     This function calls the library's EXPUNGE vector, which requests
  3095.     that a library delete itself.  The library may refuse to do this if
  3096.     it is busy or currently open. This is not typically called by user
  3097.     code.
  3098.  
  3099.     There are certain, limited circumstances where it may be
  3100.     appropriate to attempt to specifically flush a certain Library.
  3101.     Example:
  3102.  
  3103.      /* Attempts to flush the named library out of memory. */
  3104.      #include <exec/types.h>
  3105.      #include <exec/execbase.h>
  3106.  
  3107.      void FlushLibrary(name)
  3108.      STRPTR name;
  3109.      {
  3110.      struct Library *result;
  3111.  
  3112.         Forbid();
  3113.         if(result=(struct Library *)FindName(&SysBase->LibList,name))
  3114.         RemLibrary(result);
  3115.         Permit();
  3116.      }
  3117.  
  3118.    INPUTS
  3119.     library - pointer to a library node structure
  3120.  
  3121. exec.library/Remove                     exec.library/Remove
  3122.  
  3123.    NAME
  3124.     Remove -- remove a node from a list
  3125.  
  3126.    SYNOPSIS
  3127.     Remove(node)
  3128.            A1
  3129.  
  3130.     void Remove(struct Node *);
  3131.  
  3132.    FUNCTION
  3133.     Remove a node from whatever list it is in.  Nodes that are not part
  3134.     of a list must not be Removed!  Assembly programmers may prefer to
  3135.     use the REMOVE macro from "exec/lists.i".
  3136.  
  3137.    WARNING
  3138.     This function does not arbitrate for access to the list.  The
  3139.     calling task must be the owner of the involved list.
  3140.  
  3141.    INPUTS
  3142.     node - the node to remove
  3143.  
  3144.    SEE ALSO
  3145.     AddHead, AddTail, Enqueue, Insert, RemHead, RemTail
  3146.  
  3147. exec.library/RemPort                    exec.library/RemPort
  3148.  
  3149.    NAME
  3150.     RemPort -- remove a message port from the system
  3151.  
  3152.    SYNOPSIS
  3153.     RemPort(port)
  3154.         A1
  3155.  
  3156.     void RemPort(struct MsgPort *);
  3157.  
  3158.    FUNCTION
  3159.     This function removes a message port structure from the system's
  3160.     message port list.  Subsequent attempts to rendezvous by name with
  3161.     this port will fail.
  3162.  
  3163.    INPUTS
  3164.     port - pointer to a message port
  3165.  
  3166.    SEE ALSO
  3167.     AddPort, FindPort
  3168.  
  3169. exec.library/RemResource                exec.library/RemResource
  3170.  
  3171.    NAME
  3172.     RemResource -- remove a resource from the system
  3173.  
  3174.    SYNOPSIS
  3175.     RemResource(resource)
  3176.            A1
  3177.  
  3178.     void RemResource(APTR);
  3179.  
  3180.    FUNCTION
  3181.     This function removes an existing resource from the system resource
  3182.     list.  There must be no outstanding users of the resource.
  3183.  
  3184.    INPUTS
  3185.     resource - pointer to a resource node
  3186.  
  3187.    SEE ALSO
  3188.     AddResource
  3189.  
  3190. exec.library/RemSemaphore               exec.library/RemSemaphore
  3191.  
  3192.    NAME
  3193.     RemSemaphore -- remove a signal semaphore from the system
  3194.  
  3195.    SYNOPSIS
  3196.     RemSemaphore(signalSemaphore)
  3197.              A1
  3198.  
  3199.     void RemSemaphore(struct SignalSemaphore *);
  3200.  
  3201.    FUNCTION
  3202.     This function removes a signal semaphore structure from the
  3203.     system's signal semaphore list.  Subsequent attempts to
  3204.     rendezvous by name with this semaphore will fail.
  3205.  
  3206.    INPUTS
  3207.        signalSemaphore -- an initialized signal semaphore structure
  3208.  
  3209.    SEE ALSO
  3210.     AddSemaphore, FindSemaphore
  3211.  
  3212.  
  3213. exec.library/RemTail                    exec.library/RemTail
  3214.  
  3215.    NAME
  3216.     RemTail -- remove the tail node from a list
  3217.  
  3218.    SYNOPSIS
  3219.     node = RemTail(list)
  3220.     D0           A0
  3221.  
  3222.     struct Node *RemTail(struct List *);
  3223.  
  3224.    FUNCTION
  3225.     Remove the last node from a list, and return a pointer to it. If
  3226.     the list is empty, return zero. Assembly programmers may prefer to
  3227.     use the REMTAIL macro from "exec/lists.i".
  3228.  
  3229.    WARNING
  3230.     This function does not arbitrate for access to the list.  The
  3231.     calling task must be the owner of the involved list.
  3232.  
  3233.    INPUTS
  3234.     list - a pointer to the target list header
  3235.  
  3236.    RESULT
  3237.     node - the node removed or zero when empty list
  3238.  
  3239.    SEE ALSO
  3240.     AddHead, AddTail, Enqueue, Insert, Remove, RemHead, RemTail
  3241.  
  3242. exec.library/RemTask                    exec.library/RemTask
  3243.  
  3244.    NAME
  3245.     RemTask -- remove a task from the system
  3246.  
  3247.    SYNOPSIS
  3248.     RemTask(task)
  3249.         A1
  3250.  
  3251.     void RemTask(struct Task *);
  3252.  
  3253.    FUNCTION
  3254.     This function removes a task from the system.  Deallocation of
  3255.     resources should have been performed prior to calling this
  3256.     function.  Removing some other task is very dangerous.    Generally
  3257.     is is best to arrange for tasks to call RemTask(0L) on themselves.
  3258.  
  3259.     RemTask will automagically free any memory lists attached to the
  3260.     task's TC_MEMENTRY list.
  3261.  
  3262.    INPUTS
  3263.     task - pointer to the task node representing the task to be
  3264.            removed.  A zero value indicates self removal, and will
  3265.            cause the next ready task to begin execution.
  3266.  
  3267.    SEE ALSO
  3268.     AddTask, exec/AllocEntry, amiga.lib/DeleteTask
  3269.  
  3270. exec.library/ReplyMsg                       exec.library/ReplyMsg
  3271.  
  3272.    NAME
  3273.     ReplyMsg -- put a message to its reply port
  3274.  
  3275.    SYNOPSIS
  3276.     ReplyMsg(message)
  3277.          A1
  3278.  
  3279.     void ReplyMsg(struct Message *);
  3280.  
  3281.    FUNCTION
  3282.     This function sends a message to its reply port.  This is usually
  3283.     done when the receiver of a message has finished and wants to
  3284.     return it to the sender (so that it can be re-used or deallocated,
  3285.     whatever).
  3286.  
  3287.     This call may be made from interrupts.
  3288.  
  3289.    INPUT
  3290.     message - a pointer to the message
  3291.  
  3292.    IMPLEMENTATION
  3293.     1> Places "NT_REPLYMSG" into LN_TYPE.
  3294.     2> Puts the message to the port specified by MN_REPLYPORT
  3295.        If there is no replyport, sets LN_TYPE to "NT_FREEMSG" (use this
  3296.        feature only with extreeme care).
  3297.  
  3298.    SEE ALSO
  3299.     GetMsg, PutMsg, exec/ports.h
  3300.  
  3301. exec.library/SendIO                     exec.library/SendIO
  3302.  
  3303.    NAME
  3304.     SendIO -- initiate an I/O command
  3305.  
  3306.    SYNOPSIS
  3307.     SendIO(iORequest)
  3308.            A1
  3309.  
  3310.     void SendIO(struct IORequest *);
  3311.  
  3312.    FUNCTION
  3313.     This function requests the device driver start processing the given
  3314.     I/O request.  The device will return control without waiting for
  3315.     the I/O to complete.
  3316.  
  3317.     The io_Flags field of the IORequest will be set to zero before the
  3318.     request is sent.  See BeginIO() for more details.
  3319.  
  3320.    INPUTS
  3321.     iORequest - pointer to an I/O request, or a device specific
  3322.             extended IORequest.
  3323.  
  3324.    SEE ALSO
  3325.     DoIO, CheckIO, WaitIO, AbortIO
  3326.  
  3327. exec.library/SetExcept                      exec.library/SetExcept
  3328.  
  3329.    NAME
  3330.     SetExcept -- define certain signals to cause exceptions
  3331.  
  3332.    SYNOPSIS
  3333.     oldSignals = SetExcept(newSignals, signalMask)
  3334.     D0               D0       D1
  3335.  
  3336.     ULONG SetExcept(ULONG,ULONG);
  3337.  
  3338.    FUNCTION
  3339.     This function defines which of the task's signals will cause a
  3340.     private task exception.  When any of the signals occurs the task's
  3341.     exception handler will be dispatched.  If the signal occurred prior
  3342.     to calling SetExcept, the exception will happen immediately.
  3343.  
  3344.     The user function pointed to by the task's tc_ExceptCode gets
  3345.     called as:
  3346.  
  3347.         newExcptSet = <exceptCode>(signals, exceptData),SysBase
  3348.         D0                   D0    A1        A6
  3349.  
  3350.         signals - The set of signals that caused this exception.  These
  3351.         Signals have been disabled from the current set of signals
  3352.         that can cause an exception.
  3353.  
  3354.         exceptData - A copy of the task structure tc_ExceptData field.
  3355.  
  3356.         newExcptSet - The set of signals in NewExceptSet will be re-
  3357.         enabled for exception generation.  Usually this will be the
  3358.         same as the Signals that caused the exception.
  3359.  
  3360.     All registers are preserved by the system before the call.
  3361.  
  3362.  
  3363.    INPUTS
  3364.     newSignals - the new values for the signals specified in
  3365.         signalMask.
  3366.     signalMask - the set of signals to be effected
  3367.  
  3368.    RESULTS
  3369.     oldSignals - the prior exception signals
  3370.  
  3371.    EXAMPLE
  3372.     Get the current state of all exception signals:
  3373.         SetExcept(0,0)
  3374.     Change a few exception signals:
  3375.         SetExcept($1374,$1074)
  3376.  
  3377.    SEE ALSO
  3378.     Signal, SetSignal
  3379.  
  3380. exec.library/SetFunction                exec.library/SetFunction
  3381.  
  3382.    NAME
  3383.     SetFunction -- change a function vector in a library
  3384.  
  3385.    SYNOPSIS
  3386.     oldFunc = SetFunction(library, funcOffset, funcEntry)
  3387.     D0              A1       A0.W       D0
  3388.  
  3389.     APTR SetFunction(struct Library *,LONG,APTR);
  3390.  
  3391.    FUNCTION
  3392.     SetFunction is a functional way of changing where vectors in a
  3393.     library point.    They are changed in such a way that the
  3394.     checksumming process will never falsely declare a library to be
  3395.     invalid.
  3396.  
  3397.    NOTE
  3398.     SetFunction cannot be used on non-standard libraries like
  3399.     dos.library.  Here you must manually Forbid(), preserve all 6
  3400.     original bytes, set the new vector, SumLibrary(), then Permit().
  3401.  
  3402.    INPUTS
  3403.     library    - a pointer to the library to be changed
  3404.     funcOffset - the offset of the function to be replaced
  3405.     funcEntry  - pointer to new function
  3406.  
  3407.    RESULTS
  3408.     oldFunc    - pointer to the old function that was just replaced
  3409.  
  3410. exec.library/SetIntVector                  exec.library/SetIntVector
  3411.  
  3412.    NAME
  3413.     SetIntVector -- set a new handler for a system interrupt vector
  3414.  
  3415.    SYNOPSIS
  3416.     oldInterrupt = SetIntVector(intNumber, interrupt)
  3417.     D0                D0         A1
  3418.  
  3419.     struct Interrupt *SetIntVector(ULONG, struct Interrupt *);
  3420.  
  3421.    FUNCTION
  3422.     This function provides a mechanism for setting the system interrupt
  3423.     vectors.  These are non-sharable; setting a new interrupt handler
  3424.     disconnects the old one.  Installed handlers are responsible for 
  3425.     processing, enabling and clearing the interrupt.  Note that interrupts
  3426.     may have been left in any state by the previous code.
  3427.  
  3428.     The IS_CODE and IS_DATA pointers of the Interrupt structure will
  3429.     be copied into a private place by Exec.  A pointer to the previously
  3430.     installed Interrupt structure is returned.
  3431.  
  3432.     When the system calls the specified interrupt code, the registers are
  3433.     setup as follows:
  3434.  
  3435.         D0 - scratch
  3436.         D1 - scratch (on entry: active portia
  3437.               interrupts -> equals INTENA & INTREQ)
  3438.  
  3439.         A0 - scratch (on entry: pointer to base of custom chips
  3440.               for fast indexing)
  3441.         A1 - scratch (on entry: Interrupt's IS_DATA pointer)
  3442.  
  3443.         A5 - jump vector register (scratch on call)
  3444.         A6 - Exec library base pointer (scratch on call)
  3445.  
  3446.         all other registers must be preserved
  3447.  
  3448.    INPUTS
  3449.     intNum - the Portia interrupt bit number (0..14).  Only non-chained
  3450.          interrupts should be set.  Use AddIntServer() for server
  3451.          chains.
  3452.     interrupt - a pointer to an Interrupt structure containing the
  3453.          handler's entry point and data segment pointer.  A NULL
  3454.          interrupt pointer will remove the current interrupt and
  3455.          set illegal values for IS_CODE and IS_DATA.
  3456.  
  3457.          By convention, the LN_NAME of the interrupt structure must
  3458.          point a descriptive string so that other users may
  3459.          identify who currently has control of the interrupt.
  3460.  
  3461.    RESULT
  3462.     A pointer to the prior interrupt structure which had control
  3463.     of this interrupt.
  3464.  
  3465.    SEE ALSO
  3466.     AddIntServer(),exec/interrupts.i,exec/hardware.i
  3467.  
  3468. exec.library/SetSignal                       exec.library/SetSignal
  3469.  
  3470.    NAME
  3471.     SetSignal -- define the state of this task's signals
  3472.  
  3473.    SYNOPSIS
  3474.     oldSignals = SetSignal(newSignals, signalMask)
  3475.     D0               D0       D1
  3476.  
  3477.     ULONG SetSignal(ULONG,ULONG);
  3478.  
  3479.    FUNCTION
  3480.     This function can query or modify the state of the current task's
  3481.     received signal mask.  Setting the state of signals is considered
  3482.     dangerous.  Reading the state of signals is safe.
  3483.  
  3484.    INPUTS
  3485.     newSignals - the new values for the signals specified in
  3486.              signalSet.
  3487.     signalMask - the set of signals to be affected.
  3488.  
  3489.    RESULTS
  3490.     oldSignals - the prior values for all signals
  3491.  
  3492.    EXAMPLES
  3493.     Get the current state of all signals:
  3494.         SetSignal(0L,0L);
  3495.     Clear all signals:
  3496.         SetSignal(0L,0xFFFFFFFFL);
  3497.     Clear the CTRL-C signal:
  3498.         SetSignal(0L,SIGBREAKF_CTRL_C);
  3499.  
  3500.  
  3501.     Check if the CTRL-C signal was pressed:
  3502.  
  3503.         #include <libraries/dos.h>
  3504.  
  3505.         if(SetSignal(0L,0L) & SIGBREAKF_CTRL_C) /* Hit since last check? */
  3506.         {
  3507.             SetSignal(0L,SIGBREAKF_CTRL_C);    /* Clear old status */
  3508.         printf("CTRL-C pressed!\n");
  3509.         }
  3510.  
  3511.    SEE ALSO
  3512.     Signal, Wait
  3513.  
  3514. exec.library/SetSR                      exec.library/SetSR
  3515.  
  3516.    NAME
  3517.     SetSR -- get and/or set processor status register
  3518.  
  3519.    SYNOPSIS
  3520.     oldSR = SetSR(newSR, mask)
  3521.     D0          D0     D1
  3522.  
  3523.     ULONG SetSR(ULONG, ULONG);
  3524.  
  3525.    FUNCTION
  3526.     This function provides a means of modifying the CPU status register
  3527.     in a "safe" way (well, how safe can a function like this be
  3528.     anyway?).  This function will only affect the status register bits
  3529.     specified in the mask parameter.  The prior content of the entire
  3530.     status register is returned.
  3531.  
  3532.    INPUTS
  3533.     newSR - new values for bits specified in the mask.
  3534.         All other bits are not effected.
  3535.     mask - bits to be changed
  3536.  
  3537.    RESULTS
  3538.     oldSR - the entire status register before new bits
  3539.  
  3540.    EXAMPLES
  3541.     To get the current SR:
  3542.         currentSR = SetSR(0,0);
  3543.     To change the processor interrupt level to 3:
  3544.         oldSR = SetSR($0300,$0700);
  3545.     Set processor interrupts back to prior level:
  3546.         SetSR(oldSR,$0700);
  3547.  
  3548. exec.library/SetTaskPri                  exec.library/SetTaskPri
  3549.  
  3550.    NAME
  3551.     SetTaskPri -- get and set the priority of a task
  3552.  
  3553.    SYNOPSIS
  3554.     oldPriority = SetTaskPri(task, priority)
  3555.     D0-0:8             A1    D0-0:8
  3556.  
  3557.     BYTE SetTaskPri(struct Task *,LONG);
  3558.  
  3559.    FUNCTION
  3560.     This function changes the priority of a task regardless of its
  3561.     state.    The old priority of the task is returned.  A reschedule is
  3562.     performed, and a context switch may result.
  3563.  
  3564.     To change the priority of the currently running task, pass the
  3565.     result of FindTask(0); as the task pointer.
  3566.  
  3567.    INPUTS
  3568.     task - task to be affected
  3569.     priority - the new priority for the task
  3570.  
  3571.    RESULT
  3572.     oldPriority - the tasks previous priority
  3573.  
  3574. exec.library/Signal                     exec.library/Signal
  3575.  
  3576.    NAME
  3577.     Signal -- signal a task
  3578.  
  3579.    SYNOPSIS
  3580.     Signal(task, signals)
  3581.            A1    D0
  3582.  
  3583.     void Signal(struct Task *,ULONG);
  3584.  
  3585.    FUNCTION
  3586.     This function signals a task with the given signals.  If the task
  3587.     is currently waiting for one or more of these signals, it will be
  3588.     made ready and a reschedule will occur. If the task is not waiting
  3589.     for any of these signals, the signals will be posted to the task
  3590.     for possible later use. A signal may be sent to a task regardless
  3591.     of whether its running, ready, or waiting.
  3592.  
  3593.     This function is considered "low level".  Its main purpose is to
  3594.     support multiple higher level functions like PutMsg.
  3595.  
  3596.     This function is safe to call from interrupts.
  3597.  
  3598.    INPUT
  3599.     task - the task to be signalled
  3600.     signals - the signals to be sent
  3601.  
  3602.    SEE ALSO
  3603.     Wait, SetSignal
  3604.  
  3605. exec.library/SumKickData                exec.library/SumKickData
  3606.  
  3607.    NAME
  3608.     SumKickData -- compute the checksum for the Kickstart delta list
  3609.  
  3610.    SYNOPSIS
  3611.     void SumKickData(void)
  3612.  
  3613.    FUNCTION
  3614.     The Amiga system has some ROM (or Kickstart) resident code that
  3615.     provides the basic functions for the machine.  This code is
  3616.     unchangeable by the system software.  This function is part of a
  3617.     support system to modify parts of the ROM.
  3618.  
  3619.     The ROM code is linked together at run time via ROMTags (also known
  3620.     as Resident structures, defined in exec/resident.h).  These tags tell
  3621.     Exec's low level boot code what subsystems exist in which regions of
  3622.     memory.  The current list of ROMTags is contained in the ResModules
  3623.     field of ExecBase.  By default this list contains any ROMTags found
  3624.     in the address ranges $FC0000-$FFFFFF and $F00000-$F7FFFF.
  3625.  
  3626.     There is also a facility to selectively add or replace modules to the
  3627.     ROMTag list.  These modules can exist in RAM, and the memory they
  3628.     occupy will be deleted from the memory free list during the boot
  3629.     process.  SumKickData() plays an important role in this run-time
  3630.     modification of the ROMTag array.
  3631.  
  3632.     Three variables in ExecBase are used in changing the ROMTag array:
  3633.     KickMemPtr, KickTagPtr, and KickCheckSum. KickMemPtr points to a
  3634.     linked list of MemEntry structures. The memory that these MemEntry
  3635.     structures reference will be allocated (via AllocAbs) at boot time.
  3636.     The MemEntry structure itself must also be in the list.
  3637.  
  3638.     KickTagPtr points to a long-word array of the same format as the
  3639.     ResModules array.  The array has a series of pointers to ROMTag
  3640.     structures.  The array is either NULL terminated, or will have an
  3641.     entry with the most significant bit (bit 31) set.  The most
  3642.     significant bit being set says that this is a link to another
  3643.     long-word array of ROMTag entries.  This new array's address can be
  3644.     found by clearing bit 31.
  3645.  
  3646.     KickCheckSum has the result of SumKickData().  It is the checksum of
  3647.     both the KickMemPtr structure and the KickTagPtr arrays.  If the
  3648.     checksum does not compute correctly then both KickMemPtr and
  3649.     KickTagPtr will be ignored.
  3650.  
  3651.     If all the memory referenced by KickMemPtr can't be allocated then
  3652.     KickTagPtr will be ignored.
  3653.  
  3654.     There is one more important caveat about adding ROMTags. All this
  3655.     ROMTag magic is run very early on in the system -- before expansion
  3656.     memory is added to the system. Therefore any memory in this
  3657.     additional ROMTag area must be addressable at this time. This means
  3658.     that your ROMTag code, MemEntry structures, and resident arrays
  3659.     cannot be in expansion memory.  There are two regions of memory that
  3660.     are acceptable:  one is chip memory, and the other is "Ranger" memory
  3661.     (memory in the range between $C00000-$D80000).
  3662.  
  3663.     Remember that changing an existing ROMTag entry falls into the
  3664.     "heavy magic" category -- be very careful when doing it.  The odd are
  3665.     that you will blow yourself out of the water.
  3666.  
  3667.    NOTE
  3668.     SumKickData was introduced in the 1.2 release
  3669.  
  3670.    SEE ALSO
  3671.     InitResident, FindResident
  3672.  
  3673. exec.library/SumLibrary                  exec.library/SumLibrary
  3674.  
  3675.    NAME
  3676.     SumLibrary -- compute and check the checksum on a library
  3677.  
  3678.    SYNOPSIS
  3679.     SumLibrary(library)
  3680.            A1
  3681.  
  3682.     void SumLibrary(struct Library *);
  3683.  
  3684.    FUNCTION
  3685.     SumLibrary computes a new checksum on a library.  It can also be
  3686.     used to check an old checksum.    If an old checksum does not match,
  3687.     and the library has not been marked as changed, then the system
  3688.     will call Alert().
  3689.  
  3690.     This call could also be periodically made by some future
  3691.     system-checking task.
  3692.  
  3693.    INPUTS
  3694.     library - a pointer to the library to be changed
  3695.  
  3696.    NOTE
  3697.     An alert will occur if the checksum fails.
  3698.  
  3699.    SEE ALSO
  3700.     SetFunction
  3701.  
  3702. exec.library/SuperState                  exec.library/SuperState
  3703.  
  3704.    NAME
  3705.     SuperState -- enter supervisor state with user stack
  3706.  
  3707.    SYNOPSIS
  3708.     oldSysStack = SuperState()
  3709.     D0
  3710.  
  3711.     APTR SuperState(void);
  3712.  
  3713.    FUNCTION
  3714.     Enter supervisor mode while running on the user's stack. The user
  3715.     still has access to user stack variables.  Be careful though, the
  3716.     user stack must be large enough to accommodate space for all
  3717.     interrupt data -- this includes all possible nesting of interrupts.
  3718.     This function does nothing when called from supervisor state.
  3719.  
  3720.    RESULTS
  3721.     oldSysStack - system stack pointer; save this.    It will come in
  3722.               handy when you return to user state.  If the system
  3723.               is already in supervisor mode, oldSysStack is zero.
  3724.  
  3725.    SEE ALSO
  3726.     UserState/Supervisor
  3727.  
  3728.  
  3729. exec.library/Supervisor                  exec.library/Supervisor
  3730.  
  3731.    NAME
  3732.     Supervisor -- trap to a short supervisor mode function
  3733.  
  3734.    SYNOPSIS
  3735.     result = Supervisor(userFunc)
  3736.     Rx                   A5
  3737.  
  3738.     ULONG Supervisor(void *);
  3739.  
  3740.    FUNCTION
  3741.     Allow a normal user-mode program to execute a short assembly language
  3742.     function in the supervisor mode of the processor.  Supervisor() does
  3743.     not modify or save registers; the user function has full access to the
  3744.     register set.   All rules that apply to interrupt code must be
  3745.     followed.  In addition, no system calls are permitted.  The function
  3746.     must end with an RTE instruction.
  3747.  
  3748.    EXAMPLE
  3749.         ;Obtain the Exception Vector base.  68010 or greater only!
  3750.         MOVECtrap:    movec.l    VBR,d0    ;$4e7a,$0801
  3751.                 rte
  3752.  
  3753.    INPUTS
  3754.     userFunc - A pointer to a short assembly language function ending
  3755.            in RTE.  The function has full access to the register set.
  3756.  
  3757.    RESULTS
  3758.     result   - Whatever values the userFunc left in the registers.
  3759.  
  3760.    SEE ALSO
  3761.     SuperState,UserState
  3762.  
  3763. exec.library/TypeOfMem                     exec.library/TypeOfMem
  3764.  
  3765.    NAME
  3766.     TypeOfMem -- determine attributes of a given memory address
  3767.  
  3768.    SYNOPSIS
  3769.     attributes = TypeOfMem(address)
  3770.     D0               A1
  3771.  
  3772.     ULONG TypeOfMem(void *);
  3773.  
  3774.    FUNCTION
  3775.     Given a RAM memory address, search the system memory lists and
  3776.     return its memory attributes.  The memory attributes are similar to
  3777.     those specified when the memory was first allocated: (eg. MEMF_CHIP
  3778.     and MEMF_FAST).
  3779.  
  3780.     This function is usually used to determine if a particular block of
  3781.     memory is within CHIP space.
  3782.  
  3783.     If the address is not in known-space, a zero will be returned.
  3784.     (Anything that is not RAM, like the ROM or expansion area, will
  3785.     return zero.  Also the first few bytes of a memory area are used up
  3786.     by the MemHeader.)
  3787.  
  3788.    INPUT
  3789.     address - a memory address
  3790.  
  3791.    RESULT
  3792.     attributes - a long word of memory attribute flags.
  3793.     If the address is not in known RAM, zero is returned.
  3794.  
  3795.    SEE ALSO
  3796.     AllocMem()
  3797.  
  3798. exec.library/UserState                      exec.library/UserState
  3799.  
  3800.    NAME
  3801.     UserState -- return to user state with user stack
  3802.  
  3803.    SYNOPSIS
  3804.     UserState(sysStack)
  3805.           D0
  3806.  
  3807.     void UserState(APTR);
  3808.  
  3809.    FUNCTION
  3810.     Return to user state with user stack, from supervisor state with
  3811.     user stack.  This function is normally used in conjunction with the
  3812.     SuperState function above.
  3813.  
  3814.     This function must not be called from the user state.
  3815.  
  3816.    INPUT
  3817.     sysStack - supervisor stack pointer
  3818.  
  3819.    BUGS
  3820.     This function is broken in V33/34 Kickstart.  Fixed in V1.31 setpatch.
  3821.  
  3822.    SEE ALSO
  3823.     SuperState/Supervisor
  3824.  
  3825. exec.library/Vacate                     exec.library/Vacate
  3826.  
  3827.    NAME
  3828.     Vacate -- release a message lock (semaphore)
  3829.  
  3830.    SYNOPSIS
  3831.     Vacate(semaphore)
  3832.            A0
  3833.  
  3834.     void Vacate(struct Semaphore *);
  3835.  
  3836.    FUNCTION
  3837.     This function releases a previously locked semaphore (see
  3838.     the Procure() function).
  3839.     If another task is waiting for the semaphore, its bidMessage
  3840.     will be sent to its reply port.
  3841.  
  3842.    INPUT
  3843.     semaphore - the semaport message port representing the
  3844.     semaphore to be freed.
  3845.  
  3846.    BUGS
  3847.     Procure() and Vacate() do not have proven reliability.
  3848.  
  3849.    SEE ALSO
  3850.     Procure
  3851.  
  3852. exec.library/Wait                       exec.library/Wait
  3853.  
  3854.    NAME
  3855.     Wait -- wait for one or more signals
  3856.  
  3857.    SYNOPSIS
  3858.     signals = Wait(signalSet)
  3859.     D0           D0
  3860.  
  3861.     ULONG Wait(ULONG);
  3862.  
  3863.    FUNCTION
  3864.     This function will cause the current task to suspend waiting for
  3865.     one or more signals.  When one or more of the specified signals
  3866.     occurs, the task will return to the ready state, and those signals
  3867.     will be cleared.
  3868.  
  3869.     If a signal occurred prior to calling Wait, the wait condition will
  3870.     be immediately satisfied, and the task will continue to run without
  3871.     delay.
  3872.  
  3873.    CAUTION
  3874.     This function cannot be called while in supervisor mode or
  3875.     interrupts!  This function will break the action of a Forbid() or
  3876.     Disable() call.
  3877.  
  3878.    INPUT
  3879.     signalSet - The set of signals for which to wait.
  3880.             Each bit represents a particular signal.
  3881.  
  3882.    RESULTS
  3883.     signals - the set of signals that were active
  3884.  
  3885. exec.library/WaitIO                     exec.library/WaitIO
  3886.  
  3887.    NAME
  3888.     WaitIO -- wait for completion of an I/O request
  3889.  
  3890.    SYNOPSIS
  3891.     error = WaitIO(iORequest)
  3892.     D0           A1
  3893.  
  3894.     BYTE WaitIO(struct IORequest *);
  3895.  
  3896.    FUNCTION
  3897.     This function waits for the specified I/O request to complete, then
  3898.     removes it from the replyport.    If the I/O has already completed,
  3899.     this function will return immediately.
  3900.  
  3901.     This function should be used with care, as it does not return until
  3902.     the I/O request completes; if the I/O never completes, this
  3903.     function will never return, and your task will hang.  If this
  3904.     situation is a possibility, it is safer to use the Wait() function.
  3905.     Wait() will return return when any of a specified set of signal is
  3906.     received.  This is how I/O timeouts can be properly handled.
  3907.  
  3908.    WARNING
  3909.     If this IORequest was "Quick" or otherwise finished BEFORE this
  3910.     call, this function drops though immediately, with no call to
  3911.     Wait().  A side effect is that the signal bit related the port may
  3912.     remain set.  Expect this.
  3913.  
  3914.     When removing a known complete IORequest from a port, WaitIO() is the
  3915.     preferred method.  A simple Remove() would require a Disable/Enable
  3916.     pair!
  3917.  
  3918.    INPUTS
  3919.     iORequest - pointer to an I/O request block
  3920.  
  3921.    RESULTS
  3922.     error - zero if successful, else an error is returned
  3923.         (a sign extended copy of io_Error).
  3924.  
  3925.    SEE ALSO
  3926.     DoIO, SendIO, CheckIO, AbortIO
  3927.  
  3928. exec.library/WaitPort                       exec.library/WaitPort
  3929.  
  3930.    NAME
  3931.     WaitPort -- wait for a given port to be non-empty
  3932.  
  3933.    SYNOPSIS
  3934.     message = WaitPort(port)
  3935.     D0           A0
  3936.  
  3937.     struct Message *WaitPort(struct MsgPort *);
  3938.  
  3939.    FUNCTION
  3940.     This function waits for the given port to become non-empty.  If
  3941.     necessary, the Wait function will be called to wait for the port
  3942.     signal.  If a message is already present at the port, this function
  3943.     will return immediately.  The return value is always a pointer to
  3944.     the first message queued (but it is not removed from the queue).
  3945.  
  3946.    CAUTION
  3947.     More than one message may be at the port when this returns.  It is
  3948.     proper to call the GetMsg() function in a loop until all messages
  3949.     have been handled, then wait for more to arrive.
  3950.  
  3951.     To wait for more than one port, combine the signal bits from each
  3952.     port into one call to the Wait() function, then use a GetMsg() loop
  3953.     to collect any and all messages.  It is possible to get a signal
  3954.     for a port WITHOUT a message showing up.  Plan for this.
  3955.  
  3956.    INPUT
  3957.     port - a pointer to the message port
  3958.  
  3959.    RETURN
  3960.     message - a pointer to the first available message
  3961.  
  3962.    SEE ALSO
  3963.     GetMsg
  3964.  
  3965.